minimum python for distribution on Windows

Markku Hänninen hmm at
Thu Mar 20 14:09:13 CET 2003

bobnotbob at (Bob Roberts) writes:
> I just tried out py2exe, and it worked great.  Is it possible to do
> something similar, but with my python source code still available (and
> able to be modified)?
> I tried just copying my source code, python.exe, and the modules I use
> into a new directory, but it keeps complaining about not having a lot
> of modules, such as "site", that I never imported.

I have been doing this with Tools/freeze/ but py2exe might be
actually better. Anyway, instead of freezing your own script, try freezing
this to get a single-file python interpreter:

#!/usr/bin/env python

# add here all the modules your script will use
import sys, os

if len(sys.argv):
    # the first argument is the name of the script to run
    # no arguments, start interactive interpreter

The downside is of course, that you must list all the modules you are 
going to need beforehand in this script. 

I have done a product installation script using this method, you can
start python directly from the install-directory by just something
like: "./spython". Of course the whole can be frozen,
but this way it is more easy to change and debug.

I have made a small page about this technic at 

   Markku Hänninen     /
     hmm at       /   "Actually it works, it just doesn't look that way." 

More information about the Python-list mailing list