Nuitka打包python成執行檔,nuitka的使用方法可以參考Python打包exe的王炸-Nuitka。
本文僅針對linux系統下的打包問題提供方案。
使用以下命令可以對linux下的python單個檔案打包,例如對index.py檔案進行打包,輸出到outpath(根據實際情況修改)目錄下:
1 | python -m nuitka --clang --standalone --windows-disable-console --recurse-all --outputdir=outpath --show-progress --plugin-no-detection --nofollow-imports index.py |
linux下建議使用clang作為C編譯器,使用gcc或g++時執行上述命令報錯。為保證上述命令正常執行,需要安裝ccache、chrpath。
注意:安裝clang後,執行