Featured image of post Python Nuitka Packaging Tutorial

Python Nuitka Packaging Tutorial

Python Nuitka packaging is a difficult thing, but it is not that difficult if you master the method

Python’s running speed and source code decompilation have always been a difficult problem. However, after using Nuitka, you will enjoy the speed of C++ and avoid the worry of being completely decompiled from the source code after being packaged by pyinstaller

Explain the difference between pyinstaller and Nuitka

The difference between the two is that pyinstaller is cooking on the spot, and everything is clearly seen by the people present (unpacking the source code), but Nuitka is a bunch of things into a paste and you don’t know what is in it. You can only roughly guess what this thing does (disassembly can only get the assembly but not the source code)

Python version selection

The older the Python version, the better, and the more compatible it is. Choosing python 3.8.10 is enough

Notes

The installation directory cannot have Chinese, otherwise there will be a lot of bugs that you can’t solve

PIP installs some things

1
2
3
pip install ordered-set # Accelerate compilation
pip install nuitka # Main program
pip install zstandard # Compress files when onefile

One-click command

1
python -m nuitka --mingw64 --standalone --output-dir=out --show-progress --onefile main.py

You can save it as build.bat so you can open it and use it

2022-2025做了三年的事情,得到了很多收获也看到了这个世界的另一面。
Built with Hugo
Theme Stack designed by Jimmy