|
发表于 2006-6-16 15:19:38
|
显示全部楼层
Well, form http://www.py2exe.org/ you can find this secton maybe something help to you
Using py2exe
Assuming you have written a python script myscript.py which you want to convert into an executable windows program, able to run on systems without a python installation. If you don't already have written a distutils setup-script, write one, and insert the statement import py2exe before the call to the setup function:
# setup.py
from distutils.core import setup
import py2exe
setup(console=["myscript.py"])
Running
python setup.py py2exe --help
will display all available command-line flags to the py2exe command.
Now you can call the setup script like in this way:
python setup.py py2exe
and a subdirectory dist will be created, containing the files myscript.exe, python23.dll, and library.zip. If your script uses compiled C extension modules, they will be copied here as well, also all dlls needed at runtime (except the system dlls).
These files include everything that is needed for your program, and you should distribute the whole directory contents.
The above setup script creates a console program, if you want a GUI program without the console window, simply replace console=["myscript.py"] with windows=["myscript.py"].
py2exe can create more than one exe file in one run, this is useful if you have a couple of related scripts. Pass a list of all scripts in the console and/or windows keyword argument. |
|