How to Compile Python Commands
- 1). Go to the py2exe project page on Sourceforge.net. Download and install the program.
- 2). Open a new Notepad document. Type:
from distutils.core import setup
import py2exe
setup(console=['example.py'])
Replace "example" with your Python file's name. Save the Notepad document as "setup," then rename it from "setup.txt" to "setup.py." - 3). Click the Windows "Start" icon. Type "cmd" and press "Enter" to open the Windows Command Prompt.
- 4). Type "cd /" followed by the directory in which you have python installed, then press "Enter."
- 5). Type "python setup.py install" and press "Enter."
- 6). Type "python setup.py py2exe" and press "Enter."
- 7). Type "example.exe" replacing "example" with your Python program's name to test your executable.