pyqt5报错qt.qpa.plugin: Could not load the Qt platform plugin “windows“ in ““ even though it was found

win10 64位系统,安装anaconda3,python 版本3.7.4,刚开始安装了pyqt5,pyqt5-tools ,然后好用,可以使用图形界面,然后又安装了其它包或软件,就报错了,出不来图形界面。调用方式使用命令行,python test2.py,其中test2.py包含qt的图形界面程序

报错如下

qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: minimal, offscreen, webgl, windows.

尝试了如下方法:

(1)pip卸载重新安装pyqt5,pyqt5-tools,

(2)将dll 文件或dll文件所在的文件夹移动到Anaconda3\Library\plugins\platforms,

(3)conda 新建虚拟环境,并安装pyqt5,pyqt5-tools,

(4)修改环境变量法,即删除QT_PLUGIN_PATH,并删除PATH里包含platforms文件夹的项,其中platforms 文件夹中包含qwindows.dll

试过以上方法,发现报错一样,论坛上说版本不对,调试了一下

SET QT_DEBUG_PLUGINS=1

python test2.py
QFactoryLoader::QFactoryLoader() checking directory path "D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qminimal.dll"
Found metadata in lib D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qminimal.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "archreq": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qoffscreen.dll"
Found metadata in lib D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qoffscreen.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "archreq": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qwebgl.dll"
Found metadata in lib D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qwebgl.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "webgl"
        ]
    },
    "archreq": 0,
    "className": "QWebGLIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("webgl")
QFactoryLoader::QFactoryLoader() looking at "D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qwindows.dll"
Found metadata in lib D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qwindows.dll, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "windows"
        ]
    },
    "archreq": 0,
    "className": "QWindowsIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("windows")
QFactoryLoader::QFactoryLoader() checking directory path "D:/Anaconda3/platforms" ...
Cannot load library D:\Anaconda3\Lib\site-packages\PyQt5\Qt5\plugins\platforms\qwindows.dll: 找不到指定的程序。
QLibraryPrivate::loadPlugin failed on "D:/Anaconda3/Lib/site-packages/PyQt5/Qt5/plugins/platforms/qwindows.dll" : "Cannot load library D:\\Anaconda3\\Lib\\site-packages\\PyQt5\\Qt5\\plugins\\platforms\\qwindows.dll: 找不到指定的程序。"
qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: minimal, offscreen, webgl, windows.

conda list 查看pyqt 的版本

pyqt                      5.9.2            py37hd77b12b_6    defaults
pyqt5                     5.15.9                   pypi_0    pypi
pyqt5-plugins             5.15.9.2.3               pypi_0    pypi
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.12.2                  pypi_0    pypi
pyqt5-tools               5.15.9.3.3               pypi_0    pypi
pyqtwebengine             5.15.6                   pypi_0    pypi
pyqtwebengine-qt5         5.15.2                   pypi_0    pypi

我无法确认是否版本不对,也有可能是,最后又新安装了python38,然后安装pyqt5,pyqt5-tools解决的,水平有限,欢迎批评指正

参考资料:

Could not load the Qt platform plugin "windows" in "" even though it was found. | Qt Forum

2

"could not find or load the Qt platform plugin "windows" in "", | Qt Forum

3【已解决】qt.qpa.plugin: Could not load the Qt platform plugin “windows“ in ““ even though it was found.-CSDN博客

Could not load the Qt platform plugin “windows“ in ““ even though it was found._could not load the qt platform plugin "windows" in_小龙狗的博客-CSDN博客

5

PyQt5解决Qt platform plugin could be initialized - 知乎

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值