Game Development Reference
In-Depth Information
C - Running Python Programs without Python Installed
much like how you installed Python. Just keep clicking the Next button until you reach
the end.
After you have installed py2exe, you can make sure that the installation was successful
by running the interactive shell and typing the following:
>>> import py2exe
>>>
If you do not see anything, then the installation was successful. If you see this error:
>>> import py2exe
>>> import py2exe
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named py2exe
>>>
Step 2: Create Your setup.py Script
After you have installed py2exe and confirmed that it is installed, you will need to create
a Python program with the name setup.py. The contents of this program should be as
follows:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
Replace hello.py in the source code above with the filename of the Python program you
want to compile. Be sure to save the setup.py in the same folder as the Python program you
want to compile (that is, hello.py, or whatever the filename is).
Step 3: Run Your setup.py Script
Next, you will have to run your setup.py with a command line option. You cannot run
setup.py from IDLE by pushing the F5 key or selecting Run Module from the Run menu.
You must use the Windows command line.
To start the Windows command line, click on the Start button in the bottom left corner
and select "Run". In the windows that opens, type "cmd" and click OK.
A black window with text should appear. Type " cd c:\Python26 " (or the folder that
you have saved your programs to) to change folders to the folder containing your Python
Search WWH ::




Custom Search