Making a windows executable for your python program

There are a number of applications that let you create a windows executable from your python programs/scripts. The one I found most user friendly was PyInstaller which you can download from their website here.

Once downloaded unpack/unzip all files to a path of you choice. For the purpose of this document I put mine in the path C:\Python27\pyinstaller.

For Windows (32/64bit), Linux (32/64bit) and Mac OS X (32/64bit) precompiled boot-loaders are available. So the installation is complete now.

To be able to run this from the command prompt you will need to have added the location of the python executable to you system path. To see how to do this go here


To build your project, from the command prompt change your directory to the folder where you unpacked PyInstaller files. Mine was   C:\Python27\pyinstaller and run this:

python [opts] refers to the name of your python script which you want to package.

The [opts] part refers to the different options you can use, if left blank PyInstaller will use the defaults and you will end up with a sub-directory named after your program name in the path  your/path/to/pyinstaller/ directory. The generated files will be placed within the sub-directory yourprogram/dist; that's where the files you need will be placed. A specification file called yourprogram.spec will be created in the sub-directory yourprogram, too.

For example to package all your distribution files in the one executable which can be run on any windows machine without any dependencies use the option –onefile



For a list of all the options available go to the PyInstaller website here.