How to Compile Python Commands
Python commands automatically run on any computer with a Python interpreter installed. However, if you want to create a Python script for other people to use you should compile it into a Windows executable file. This will allow Windows users without Python to use your code. To make an EXE file out of your Python command use py2exe.
Instructions
-
-
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.
-
1