【问题标题】:"Failed to execute script pyi_rth_qt4plugins" error while running exe运行 exe 时出现“无法执行脚本 pyi_rth_qt4plugins”错误
【发布时间】:2021-03-28 15:03:03
【问题描述】:

我使用 PyQt4 制作了我的应用程序,它可以使用 pyinstaller 执行。可执行文件在我的系统上运行良好。我的系统也安装了 PyQt5。

问题是当我尝试在目标系统(客户端系统)上运行相同的可执行文件时,它给了我一个错误Failed to execute script pyi_rth_qt4plugins。客户端系统没有 Python 或任何版本的 PyQt。

我想知道为什么会这样。我什至无法找到pyi_rth_qt4plugins 在可执行文件中的位置。我是否还需要在我的客户系统中安装 Python 和 PyQt?

【问题讨论】:

标签: python-3.x user-interface pyqt pyqt4 pyinstaller


【解决方案1】:

根据这里https://github.com/pyinstaller/pyinstaller/issues/2461长线程的回答

在站点包(PyInstaller 所在的位置)中编辑以下文件:

PyInstaller/loader/rthooks.dat

删除这一行:

'PyQt4': ['pyi_rth_qt4plugins.py'],

Python3.5也会出现这个错误,如果你使用的是3.5你可以降级到3.4来避免这个错误 在这里查看https://github.com/pyinstaller/pyinstaller/issues/2207

或者如果你不想降级 python,你可以升级到 PyQt5

【讨论】:

  • 我已经使用 Python 3.7.6 开发了应用程序......并且该 exe 是大约 2 个月前制作的。你能告诉我一种可能通过修改 .exe 来使其工作的方法吗?
  • 无法通过修改 exe 使其工作。唯一的方法是在代码中或在生成 exe 时
  • 升级到 PyQt5 对我来说是最好的选择。
猜你喜欢
  • 2019-08-03
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 1970-01-01
  • 2019-11-04
  • 1970-01-01
  • 1970-01-01
  • 2021-03-17
相关资源
最近更新 更多