Pyinstaller:无法执行脚本pyi_rth_qt4plugins

问题描述 投票:1回答:1

当我运行由pyinstaller创建的.exe时,它会显示错误消息,如下面的屏幕截图所示。

the error I got when I run the exe

我使用Python 3.6.4,pyinstaller 3.4和PyQt5 5.12在Windows 10中制作我的GUI程序。为什么.exe运行.exe时需要PySide模块和PyQt4?我不明白。 .py可以运行没有任何错误。

实际上,在我收到此错误之前,我在生成exe的过程中遇到了错误Exception:Cannot find PyQt4 plugin directories,但我认为我不需要PyQt4所以我卸载了它。然后pyinstaller进程继续,直到我遇到新的错误。

Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: C:/qt64/qt_1544645195969/_h_env/Library/plugins

我通过将pyqt5qmlplugin.dll复制到上面提到的路径C:/qt64/qt_1544645195969/_h_env/Library/plugins解决了这个问题。最后我得到了.exe,但遗憾的是我仍然遇到屏幕截图中显示的错误,我无法使用pip安装PyQt4。它报告:

Could not find a version that satisfies the requirement PyQt4 (from versions: )  
No matching distribution found for PyQt4

我也无法安装PySide,因为only these Python versions are supported: [(2.6), (2.7), (3.2), (3.3), (3.4)]

python pyqt5 pyside pyinstaller
1个回答
0
投票

对我有用的是使用Python 3.5创建一个新环境并安装脚本所需的所有库。如果您使用的是Anaconda,请按照以下步骤操作:

conda创建yourenvironmentname python = 3.5

conda激活你的环境名称

将“yourenvironmentname”替换为您希望用于您的环境的任何名称。

如果不使用Anaconda:

pipenv --python 3.5

如果它不起作用,请尝试使用python 3.4。

© www.soinside.com 2019 - 2024. All rights reserved.