Python 打包工具 Nuitka
Contents
Nuitka is a Python compiler written in Python.
Install Nuitka
-
python -m pip install nuitka
-
Verify using command
python -m nuitka --version
Write some code and test
Create a folder for the Python code
- mkdir HelloWorld
- make a python file named hello.py
|
|
Test your program
Do as you normally would. Running Nuitka on code that works incorrectly is not easier to debug.
|
|
Build it using
|
|
Note
This will prompt you to download a C caching tool (to speed up repeated compilation of generated C code) and a MinGW64 based C compiler, unless you have a suitable MSVC installed. Say yes to both those questions.
Run it
Execute the hello.exe created near hello.py.
参数
|
|
--onefile
选项会将所有依赖打包进一个可执行文件中,--standalone
选项会确保该可执行文件在没有额外依赖的情况下运行。