Pyinstaller打包python程序,以及遇到的问题:Cannot find existing PyQt5 plugin directories...

  • 将自己的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
    解决方法:在main.spec 的开头加上
    import sys
    sys.setrecursionlimit(5000)
    1. Run pyinstaller and stop it to generate the spec file :

      pyinstaller filename.py

      A file with .spec as extension should be generated

    2. Now add the following lines to the beginning of the spec file :

      import sys
      sys.setrecursionlimit(5000)
    3. 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:\qt5b\qt_1524647842210\_h_env\Library\plugins,将刚才复制出来的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'

转载于:https://www.cnblogs.com/andy-0212/p/9958820.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值