Friday, December 16, 2011

convert python scripts to .exe executable file

convert python scripts to .exe executable file

py2exe -
http://www.py2exe.org/

py2app -
http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html

cx_Freeze - is a set of scripts and modules for freezing Python scripts into executables in much the same way that py2exe and py2app do. Unlike these two tools, cx_Freeze is cross platform and should work on any platform that Python itself works on. It requires Python 2.3 or higher since it makes use of the zip import facility which was introduced in that version.

// supports Python 3.2

http://cx-freeze.sourceforge.net/

===
scru: If you know C, you can make a bootstrap app that embeds the interpreter and then runs your script. I think it's just a few lines of code, but you would have to distribute python30.dll alongside the parts of the standard library that your program uses.
===
Nicholas Knight: There's nothing stopping you from including a prebuilt Python environment in your package/installer and either creating an appropriate shortcut to launch the Python app, or creating a separate executable that launches the Python app (or even linking the Python interpreter into the executable and using it like that...). It just takes some more effort making sure you've got all the right pieces (like .dlls) where they need to be.

Remember, Python doesn't have to be "installed" per se, you just need to make sure it knows where to find everything (e.g. set the appropriate environment variables like PYTHONPATH in whatever launcher you're using).
===
Reference:
http://www.daniweb.com/software-development/python/threads/192343
http://stackoverflow.com/questions/3447093/what-technologies-exist-to-create-stand-alone-executables-for-python-3

No comments: