本文仅提供一些相关的Python源码隐藏的一些思路和大致流程来参考
具体的nuitka打包教程请参考其他文章
完整打包含运行环境
nuitka --standalone --lto=no --report=report.xml --mingw64 --show-progress --show-memory --output-dir=o test2.py --nofollow-imports
这样打包的可以在各个环境运行
仅打包特定源码
py源码添加环境变量
为了在解释器目录下运行脚本时能够顺利找到依赖最上方加入以下代码
p_env = os.path.join(os.path.dirname(__file__), 'Lib\site-packages')
sys.path.append(p_env )
编译
即使要编译指定py文件,也要完整打包。不然复制到其他目录就报错
nuitka --standalone --lto=no --report=report.xml --mingw64 --show-progress --show-memory --output-dir=o test2.py --nofollow-imports
复制文件
进入完成后目录里,将打包好的exe以及以下文件复制到解释器目录
select.pyd
unicodedata.pyd
配合pyinstaller
先利用Pyinstaller 打包好
然后利用 仅打包特定源码
这一步骤需要的几个文件全部复制到Pyinstaller 打包完成的目录即可