How to turn python script into executable

Started by
4 comments, last by Mr T 87 15 years, 9 months ago
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.
** boolean010 **
Advertisement
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
--------------------------------------Not All Martyrs See Divinity, But At Least You Tried
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:
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.
Thanks for taking the time to respond. I learned a couple of things.
** boolean010 **
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.
Try Py2Exe for windows or for any other platform google 'CX_Freeze'.

Regards,
Adam
<iframe scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:240px;height:26px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;" src="http://cid-ff6c6c9c2a46861c.skydrive.live.com/embedrow.aspx/Software/Cool.Down%201.0.msi"></iframe>

This topic is closed to new replies.

Advertisement