minimum python for distribution on Windows

Thomas Heller theller at python.net
Fri Mar 21 22:18:04 CET 2003


Dave Brueck <dave at pythonapocrypha.com> writes:

> On Fri, 21 Mar 2003, Bob Roberts wrote:
> 
> > > > Is it possible to do this without py2exe?  What if I have a
> > > > large number of scripts that use pretty much the same modules?
> > > > It would be nice to be able to distribute the python.exe, the
> > > > libraries, and my scripts without having to have the python.exe
> > > > bundled for each script.
> > >
> > > Yes, you can do this - the tradeoff is mostly that you are the one
> > > responsible for finding and including all the dependencies. The
> > > poor man's approach is to set your PATH environment variable to be
> > > empty and rename the directory Python is installed in and put
> > > Python.exe and your modules in an empty directory. Run it, see
> > > what errors occur. Repeat until done.
> >
> > I tried almost the exact same thing in the beginning, but it kept
> > requiring all sorts of modules like "site" that I never used.  Would
> > it just be that pygame was requiring them?
> 
> site gets imported by Python on startup; do a "python -v" to see this.
> 
> Better yet, though, see Thomas Heller's most recent post to this thread
> for a not-so-poor-man's approach to locating modules.

It should be added that for a minimum Python distribution, site should
probably be *not* imported. Apart from setting up some additional, site
specific sys.path entries, it adds stuff like pydoc (which includes
HTTPServer, IIRC). See the -S flag to Python.

(I always wondered why freezing 'print "hello"' script needed the
HTTPServer stuff).

Thomas




More information about the Python-list mailing list