- 将自己的python程序打包成.exe/.app(秀同学一脸呐) https://blog.csdn.net/MrLevo520/article/details/51840217
- Python程序打包成exe可执行文件 https://blog.csdn.net/zengxiantao1994/article/details/76578421
- 注意将要打包的py文件拷贝到新建的文件夹内
-
出现问题1:
- RecursionError: maximum recursion depth exceeded
import sys sys.setrecursionlimit(5000)
-
Run pyinstaller and stop it to generate the spec file :
pyinstaller filename.py
A file with
.spec
as extension should be generated -
Now add the following lines to the beginning of the spec file :
import sys sys.setrecursionlimit(5000)
-
Now run the spec file using :
pyinstaller filename.spec
-
- 在打包时会出现
问题2: Cannot find existing PyQt5 plugin directories
,具体截图如下 - 解决方法1:
- 就是用everything搜索PyQt5,找到 /Library/plugins路径下的PyQt5文件夹,将里面的dll动态库pyqt5qmlplugin.dll复制出来
- 按照错误提示的路径,一个个的新建文件夹,形成目录C:qt5bqt_1524647842210\_h_envLibraryplugins,将刚才复制出来的dll动态库拷贝进去即可
-
- 或者
-
解决方法2:
-
pyinstaller打包使用pyqt5模块的时候,在win平台下,由于pyinstaller无法准确获取QT动态库文件路径,会报错导致无法打开运行程序,并提示错误信息
pyinstaller failed to execute script pyi_rth_qt5plugins
此时我们需要在打包的时候直接告诉pyinstaller到哪里去找,即输入pyinstaller --paths C:/****/Python/Python36-32/Lib/site-packages/PyQt5/Qt/bin -F -w ****.py
-
-
问题3: 运行打包后的exe文件,出现以下问题: ModuleNotFoundError: No module named 'PyQt5.sip'
-
-
a known bug due to
sip
now being installed separately. https://github.com/pyinstaller/pyinstaller/issues/3630 -
Upon creating the installer I added the line:
--hidden-import PyQt5.sip
-
-