py2exe copies to much dlls

Anand Pillai pythonguy at
Thu Sep 4 19:34:14 CEST 2003

py2exe finds module paths by parsing your python source file.
I think it also uses the PYTHONPATH environmenet variable.
So if your PYTHONPATH contains $PYTHON/lib-tk (which it normally
does), py2exe will copy the tcl/tk dlls too into the build
directory, which are needed for tkinter.

Try editing the PYTHONPATH variable and remove the lib-tk 
directory from it.



Peter Hansen <peter at> wrote in message news:<3F573D52.32D836BD at>...
> Achim Domma wrote:
> > 
> > I managed to build a simple com server with py2exe. My script only imports
> > codecs and re, but the dist folder contains tcl84.dll, tk84.dll and
> > win32ui.pyd. Can somebody tell me why? And how to prevent this? I don't do
> > any gui stuff, so where does the dependency comes from?
> Can you py2exe the following script and see what you get?  If it's
> still the same stuff, post the py2exe script you used and
> the command line:
> # test script
> print 'Hello, world!'
> (Yes, that's all...  :-)
> -Peter

More information about the Python-list mailing list