How to turn python script into executable
I downloaded and installed py2exe-0.6.8.win32-py2.5
How am I suppose to create an executable, is it on the command line or in IDLE
test.py --------------------------------
print "Hello, World"
----------------------------------------
I tried python -O test.py, but it doesnt create an executable.
python is an interpreted language, which as far as i know means it can only be run through an interpreter, not compiled into an executable
Python is bytecode interpreted. What this means is that the Python interpreter compiles your Python source code into a bytecode format, then executes that. (Look around your system for files with the extension .pyc). To run a Python program without shell association:
With shell association, which causes all .py files to be executed by python.exe:
If you don't want the console window that pops up (say, once you start making purely graphical Python programs), rename your scripts to have a .pyw extension, or"
Now, if you actually want to create an executable for purposes of packaging and distribution, such that your end users don't need to install Python, look into py2exe.
C:\> python test1.py
With shell association, which causes all .py files to be executed by python.exe:
C:\> test1.py
If you don't want the console window that pops up (say, once you start making purely graphical Python programs), rename your scripts to have a .pyw extension, or"
C:\> pythonw test1.py
Now, if you actually want to create an executable for purposes of packaging and distribution, such that your end users don't need to install Python, look into py2exe.
I'm not sure if you edited your post or if the other posters missed the bit in your original post that said you downloaded py2exe. Either way, everything you need to know is on the py2exe site, where you probably downloaded the program from. Follow the Tutorial link, and read everything there.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement