Convert Python files to Windows executable files
12 December, 2022
Convert Python files to Windows executables with our guide. Follow our step-by-step instructions to create standalone applications for easy distribution.
Prerequisites
- You should have all the modules installed before compiling
- You should have all the requirements for the python file before compiling it
Install Nuitka on Windows
-
Go to Go to nuitka.net/download/windows which will download a .msi file
-
Run the file and click on “More info”
-
Click on “Run anyway”
-
Click on “Install for all users” then click “Next”
-
Specify the python 3.9 compiler, its easier to use the Python 3.9 from registry and click on “Finish”
Confirm installation
nuitka --version
Compile
py -m nuitka --minhw64 <filename.py> --standalone --onefile
This will make 2 folders with logs and other Nuitka files and a .exe file from your .py file.
I recommend using:
py -m nuitka --minhw64 <filename.py> --standalone --onefile --remove-output
where --remove-output
removes the 2 folders after compiling the .exe file.
that’s it ✌🏽