I have been working on a small windows command line tool that I wanted to distribute it as a single executable file on windows. I tried cx_freeze and py2exe. Both of these tools worked well, but I couldn’t find an easy way to compress make the whole program into a .exe file. py2exe and cx_freeze both create working programs, but there are always some dependent .zip archive or .dll’s somewhere that need to be distributed with it. Pyinstaller, I found, actually compresses everything into a single .exe. This makes a pretty big executable (my small command line utility created a 5MB .exe file), but it’s simple and it works.
To use pyinstaller:
grab pyinstaller 1.5rc (1.4 doesn’t work with python 2.7). extract the zip file anywhere.
change directories to the pyinstaller folder you just created.
Before you create your first executable, you will have to run this once.
Now, pyinstall needs to scan through your program and create what they call a spec file.
python makespec.py —onefile path\to\program\program.py
Now, run this command to generate the executable.
python build.py program\program.spec
Once the command has finished, the standalone executable will be available in the program\dist folder inside of pyinstaller. Instructions for how to do this for a linux executable on ubuntu linux can be found here: http://excid3.com/blog/2009/12/pyinstaller-a-simple-tutorial/. You can find more info on pyinstaller at their website: http://www.pyinstaller.org/.