1、pip install pyinstaller
2、pyinstaller -F -w QtUi.py
-F 所有支持文件全部都打包在一起,不显示其他的依赖文件(如果没有这个属性,你会发现所有生成的、所需支持的依赖文件会全部在文件夹下)
-w 在程序运行的过程中隐藏后台控制的黑窗口
此时打开exe文件,提示failed to execute script xxx
3、拷贝内容(自己做的、数据库、图片等文件夹)到:D:\sanweia\chengxu\dist\QtUi
4、例如:sqlite3.OperationalError: unable to open database file
[15752] Failed to execute script QtUi
就是没有数据库拷贝
Pyinstaller --distpath=c:\temp\dist xxx.spec --clean
pyinstaller -F -w QtUi.py
D:\sanweia\chengxu\dist\dist\QtUi在该目录下的exe才是最终运行