this application failed to start because no qt platform plugin could be initialized reinstalling the

这篇具有很好参考价值的文章主要介绍了this application failed to start because no qt platform plugin could be initialized reinstalling the。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

通过chat-GPT检索可以得到

这个错误通常是由于缺少Qt平台插件导致的。要解决这个问题,可以尝试以下方法:

1. 确保你已经正确安装了Qt平台插件。如果你使用的是conda或pip安装的Python,可以尝试重新安装PyQt或PySide。

2. 如果重新安装PyQt或PySide后仍然无法启动应用程序,你可以尝试在应用程序的顶部添加以下行:

```
import os
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = '/path/to/your/Qt/plugins/folder'
```

并将`/path/to/your/Qt/plugins/folder`替换为你自己系统中Qt插件文件夹的路径。

3. 如果以上两种方法都无效,可以尝试安装著名的Qt平台插件 Qt5VirtualkeyboardPlugin 进行修复。安装方式可参考官方文档 https://doc.qt.io/qt-5/qtvirtualkeyboard-installation.html。

希望这能帮到你解决问题。

本人配置是conda环境,但多次尝试conda install pyqt5都下载失败,尽管我配置了环境源,但依旧显示conda无法找到pyqt5, 因此,最后使用pip install pyqt5 成功。尝试了多次了卸载重新安装Pyqt5问题依旧没有解决,最开始以为问题是由于conda 和 pip 不兼容类似的原因,导致没搜索到。

尝试过的方法:

1. pip uninstall pyqt5,然后去下载pyqt5的安装包,手动安装。(失败)

2.网上检索,说可能是环境变量的问题,然后就配置了如下环境变量。(失败)this application failed to start because no qt platform plugin could be initialized reinstalling the,qt,python,开发语言

 最后解决的办法:

在codna 虚拟环境software(自定义)中,卸载pyqt5后重新安装

(software) C:\Users\Administrator>pip install pyqt5
Collecting pyqt5
  Using cached PyQt5-5.15.9-cp37-abi3-win_amd64.whl (6.8 MB)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in c:\programdata\miniconda3\envs\software\lib\site-packages (from pyqt5) (12.12.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.2 in c:\programdata\miniconda3\envs\software\lib\site-packages (from pyqt5) (5.15.2)
Installing collected packages: pyqt5
Successfully installed pyqt5-5.15.9

此时,安装完成,但运行依旧失败,所以再一次尝试重新下载,这时多了一个命令 pip install pyqt5-tools,这个是重点,可以从代码运行来看,在下载tools时,命令运行了Collecting pyqt5-plugins<5.15.9.3,>=5.15.9.2.2 (from PyQt5-tools)  Downloading 

而这正是我们所需要的插件

(software) C:\Users\Administrator>pip install PyQt5 -i https://pypi.douban.com/simple
Looking in indexes: https://pypi.douban.com/simple
Collecting PyQt5
  Downloading https://pypi.doubanio.com/packages/55/5d/8df8a2aa0de6588965d048fca9306cf15a5801be3078f195e8f8f41fa863/PyQt5-5.15.9-cp37-abi3-win_amd64.whl (6.8 MB)
     ---------------------------------------- 6.8/6.8 MB 3.9 MB/s eta 0:00:00
Requirement already satisfied: PyQt5-sip<13,>=12.11 in c:\programdata\miniconda3\envs\software\lib\site-packages (from PyQt5) (12.12.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.2 in c:\programdata\miniconda3\envs\software\lib\site-packages (from PyQt5) (5.15.2)
Installing collected packages: PyQt5
Successfully installed PyQt5-5.15.9

(software) C:\Users\Administrator>pip install PyQt5-tools -i https://pypi.douban.com/simple
Looking in indexes: https://pypi.douban.com/simple
Collecting PyQt5-tools
  Downloading https://pypi.doubanio.com/packages/11/7e/3a5bce0e31650e091a16826d7a588be8bd56c2ac30871286b6c90d68ceeb/pyqt5_tools-5.15.9.3.3-py3-none-any.whl (29 kB)
Collecting click (from PyQt5-tools)
  Downloading https://pypi.doubanio.com/packages/c2/f1/df59e28c642d583f7dacffb1e0965d0e00b218e0186d7858ac5233dce840/click-8.1.3-py3-none-any.whl (96 kB)
     ---------------------------------------- 96.6/96.6 kB 1.8 MB/s eta 0:00:00
Requirement already satisfied: pyqt5==5.15.9 in c:\programdata\miniconda3\envs\software\lib\site-packages (from PyQt5-tools) (5.15.9)
Collecting pyqt5-plugins<5.15.9.3,>=5.15.9.2.2 (from PyQt5-tools)
  Downloading https://pypi.doubanio.com/packages/ca/35/a9bdf51500444ef9121e1b3c97746dc405c1033fbbe4293d4c84867220a6/pyqt5_plugins-5.15.9.2.3-cp38-cp38-win_amd64.whl (66 kB)
     ---------------------------------------- 66.8/66.8 kB ? eta 0:00:00
Collecting python-dotenv (from PyQt5-tools)
  Downloading https://pypi.doubanio.com/packages/44/2f/62ea1c8b593f4e093cc1a7768f0d46112107e790c3e478532329e434f00b/python_dotenv-1.0.0-py3-none-any.whl (19 kB)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in c:\programdata\miniconda3\envs\software\lib\site-packages (from pyqt5==5.15.9->PyQt5-tools) (12.12.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.2 in c:\programdata\miniconda3\envs\software\lib\site-packages (from pyqt5==5.15.9->PyQt5-tools) (5.15.2)
Collecting qt5-tools<5.15.2.2,>=5.15.2.1.2 (from pyqt5-plugins<5.15.9.3,>=5.15.9.2.2->PyQt5-tools)
  Downloading https://pypi.doubanio.com/packages/e2/45/3062d0df2bbc88ee4ea04b1073072b337b9e287c0b4ac12109729b413e2e/qt5_tools-5.15.2.1.3-py3-none-any.whl (13 kB)
Collecting colorama (from click->PyQt5-tools)
  Downloading https://pypi.doubanio.com/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting qt5-applications<5.15.2.3,>=5.15.2.2.2 (from qt5-tools<5.15.2.2,>=5.15.2.1.2->pyqt5-plugins<5.15.9.3,>=5.15.9.2.2->PyQt5-tools)
  Downloading https://pypi.doubanio.com/packages/ae/a9/cd64cda6f58321c4a0021ced80117b225562efc42f1318ff2cea69c23eb7/qt5_applications-5.15.2.2.3-py3-none-win_amd64.whl (64.5 MB)
     ---------------------------------------- 64.5/64.5 MB 5.9 MB/s eta 0:00:00
Installing collected packages: qt5-applications, python-dotenv, colorama, click, qt5-tools, pyqt5-plugins, PyQt5-tools
Successfully installed PyQt5-tools-5.15.9.3.3 click-8.1.3 colorama-0.4.6 pyqt5-plugins-5.15.9.2.3 python-dotenv-1.0.0 qt5-applications-5.15.2.2.3 qt5-tools-5.15.2.1.3

但运行时依旧显示如下错误

 from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QMessageBox, QMdiSubWindow 

ModuleNotFoundError: No module named 'PyQt5.sip'

 所以我得以,将pyqt5-sip与pyqt-qt5卸载重新安装。然后运行成功!!!!

总结:

pyqt5 下载有附加工具 pyqt5-tools需要同步下载;卸载重新包一定要卸载干净!文章来源地址https://www.toymoban.com/news/detail-617540.html

到了这里,关于this application failed to start because no qt platform plugin could be initialized reinstalling the的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包