Early on in development, I immediately recognized the need for The First Fantasy to be easy distributed and ran without handing over a load of source files and asking the user to build them and also have the Python interpreter on their machine. This is where py2exe came in for me.
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
The output from using the utility is what I zip and make available in the Downloads page. Nifty huh? All that’s needed is to create a simple setup.py file in your working source directory with the following:
from distutils.core import setup import py2exe setup(console="main.py")
Then, through a batch file or command line, execute both of the commands:
python setup.py install
python setup.py py2exe
Py2exe will create a build and dist directory. The build directory can be discarded, but the dist directory contains everything needed (besides possibly a couple .dlls that the user should have) to run the program. Numerous options exist that allow you to modify the output such as renaming the executable, choosing where to place the dist directory, and several optimization options.