How can I use the py2exe to change the python3.2&#

2019-06-28 08:46发布

问题:

Possible Duplicate:
py2exe for Python 3.0

I read py2exe can create a standalone program using a Python version before the 3. How, using Python 3.2, create e.g. "Hello world.exe", please??

回答1:

p2exe is pretty much dead, unless you are using 2.7 or less.

1) Look into cx-freeze

2) Install cx-freeze

3) Create your script (test.py):

print("Hello there, anyone else hate hello worlds?")

4) Create your setup.py file

from cx_Freeze import setup, Executable

 setup(
    name = "hatefulworld",
    version = "0.1",
    description = "I wish programming was this easy",
    executables = [Executable("test.py")])

5) Execute the python command:

python setup.py build

6) **Cross your fingers, and if it was successful change to build\exe directory, and run your program.


I am glad you asked for a hello world tutorial, and not a useful one because its never as easy as above.



标签: python exe