pyinstaller

注意事项:

  • 打包时,创建新的环境
  • 尽可能在使用的电脑上进行打包

打包标准化流程

  1. # 1、安装 miniconda
  2. https://docs.conda.io/en/latest/miniconda.html
  3. # 2、创建新的虚拟环境
  4. conda create -n env_name python=3.6
  5. # 3、将所需要的包写进 requirement.txt
  6. # 4、配置 python 环境,
  7. pip install -r requirement.txt
  8. # 5、打包
  9. pyinstaller -F -w xxx.py -i logo.ico
  10. https://www.pyinstaller.org/
  11. https://pyinstaller.readthedocs.io/en/stable/usage.html
  12. """
  13. -F:打包 Python 程序为单个可执行文件
  14. -D:打包 Python 程序为一个文件夹
  15. -i:生成图标,只适用于 Windows 平台
  16. -n:指定打包后生成文件的名称
  17. -w:禁止命令行弹出
  18. """

nuitka

https://github.com/lxfly2000/7zsfx/releases

  1. nuitka --mingw64 --standalone --show-progress --nofollow-imports --plugin-enable=pylint-warnings --output-dir=out 程序.py

参考:https://zhuanlan.zhihu.com/c_1245860717607686144