PyQt5程序打包的2种方式

1.使用PyInstaller来打包:

安装:pip install PyInstaller

打包:pyinstaller -F -w [-i icon相对于入口文件的路径] main.py

2.使用fbs打包:

安装:pip install fbs

打包:1)先冻结程序:fbs freeze

     2)打包:fbs installer

fbs 基本使用:

1)新建一个项目:

fbs startproject

2)启动项目:

fbs run

3)冻结程序:

fbs freeze

4)打包:

fbs installer

window 打包注意事项:

Before you can use the installer command on Windows, please install NSIS and add its installation directory to your PATH environment variable.

The installer is created at target/TutorialSetup.exe. It lets your users pick the installation directory and adds your app to the Start Menu. It also creates an entry in Windows' list of installed programs. Your users can use this to uninstall your app. 

在Windows上使用installer命令之前,请安装NSIS并将其安装目录添加到PATH环境变量中。

安装程序是在目标位置创建的/TutorialSetup.exe教程. 它允许用户选择安装目录并将应用程序添加到“开始”菜单。它还会在Windows的已安装程序列表中创建一个条目。您的用户可以使用此卸载您的应用程序。

官网提示自己写的程序要放在项目的python 文件夹下面:

比如我新建的项目:

fbs参考文档:

https://build-system.fman.io/manual/

https://github.com/mherrmann/fbs-tutorial

原文地址:https://www.cnblogs.com/KeenLeung/p/12935318.html