1. Make sure that you already have Python 2.7.x installed.

2. Install PyInstaller by using Pip, the Python package manager.

pip install pyinstaller

3. Building the Executable

pyinstaller.exe --onefile --windowed myapp.py

If the build was successful, the final executable, app.exe, and any associated files, will be placed in the dist directory, which will be created if it doesn’t exist.

Let me briefly describe the options that are being used:

  • --onefile is used to package everything into a single executable. If you do not specify this option, the libraries, etc. will be distributed as separate files alongside the main executable.
  • --windowed prevents a console window from being displayed when the application is run. If you’re releasing a non-graphical application (i.e. a console application), you do not need to use this option.

See the PyInstaller Manual for more configuration information.

4. Adding an Icon

pyinstaller.exe --onefile --windowed --icon=app.ico myapp.py

5. Adding Version Information

File (taken from the PyInstaller test suite) is used by PyInstaller to add version information to the executable. Save this file as version.txt.

pyinstaller.exe --onefile --windowed --icon=app.ico --version-file=version.txt myapp.py


PyInstaller is a program that freezes (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX. Its main advantages over similar tools are that PyInstaller works with Python 2.7 and 3.3—3.5, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.