PyInstaller is a cross-platform tool for freezing Python scripts into executables. It can package Python scripts and dependencies into a single folder that the executable depends on, or embed them into a single stand-alone executable.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Easy to use
PyInstaller is one of the best tools for easily freezing Python Scripts and Modules into self-contained executables. It can be used via CLI with a single command and without many configurations. This tool pulls all the necessary files and libraries needed into a file to have your program run on any PC as an executable app.
Pro Easy install
Simply pip install pyinstaller
and it is ready to go.
Pro Compatible with most 3rd-party packages out-of-the-box
Most packages will work without any configuration. The community maintains a list of tested packages here. The list is incomplete so any user can contribute to it by editing the table or writing to the mailing list.
Pro Compatible with Cython modules
Pyinstaller can resolve, use, and package Cython modules into the executable.
Pro Can obfuscate Python byte code
Python bytecode can be obfuscated by specifying an encryption key with a CLI command. This should prevent most forms of tampering with the executable, such as reverse-engineering it to extract the underlying Python code. While the bytecode is encrypted using AES256, it should not be confused for security because the key can be extracted from the executable.
Pro Can add binariess to the executable
The --add-binary
flag allows you to bundle external executables along with your script. You can, for example, bundle chromium or selenium.
Cons
Con OS Specific
Any executable created can only run on the OS, bit size, and python version it was created on. If you want to create a package that runs on another machine you will need to know these exact parameters in order for it to function.
Con Not highly configurable
There is an option to dictate that the package should be completely run from one file, but other than a few other modification commands pyinstaller is not very configurable.
Con Fails to produce .exe
Produces nothing in the \dist directory, no .exe file, nothing except a \setup directory. A waste of disk space. I have a simple single python .py file, marginally above "hello", no user input, a simple parse of known binary file to a known text file. Copious unintelligible output to no effect.