出现“qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in ‘ ’even though it was found

执行.py文件报错:

一个使用Pyqt5库的Python程序时,出现报错:

// 注意看最后一段报错信息
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
loaded library "/home/XXX/.local/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so"
QObject::moveToThread: Current thread (0x2884760) is not the object's thread (0x5bf1580).
Cannot move to target thread (0x2884760)qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/XXX/.local/lib/python3.8/site-packages/cv2/qt/plugins" 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: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

很明显,从问题描述来看,说的是libxcb.so库“能够找到,但是无法加载”。

走的弯路的解决方案:

参照网址链接: Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题.。
说是应该libxcb.so库链接不正确,也就是当加载libxcb.so库时,还需要加载libxcb-xinerama库,于是我就安装了这个库:

//安装libxcb-xinerama0库
sudo apt-get install libxcb-xinerama0

但问题人仍然没解决,不过感谢博主的记录。

继续查找问题,发现参照网址链接: 关于qt缺少xcb问题终极解决办法.
这个博主说是缺少/lib64/libQt5XcbQpa.so.5和
解决问题的关键在于,添加环境变量:export QT_DEBUG_PLUGINS=1。
但对于我的问题仍然无效,经过多次尝试配环境和补充libxcb.so库相关文件未果,最终决定卸载先opencv再重装,最终解决我的问题。

最终解决方案

//最终解决方法
pip3 uninstall opencv-python
pip3 install opencv-contrib-python
sudo apt-get install python3-opencv

结语

遇到问题不断解决问题,相信最终会解决问题的!
最后,祝大家好运,都能成功解决bug,生活人仍然美好!!!

出现“qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ‘ ’even though it was found相关推荐

  1. 【Qt】Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

    1.问题描述 在ubuntu18.04中第一次安装QT5,运行时报错 qtcreator.sh qt.qpa.plugin: Could not load the Qt platform plugin ...

  2. Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

    Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin "xcb"问题 问题描述 定位问题 解决 ...

  3. qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it was found. This appl

    在ubuntu上使用qt出现报错:qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" ...

  4. uBuntu20.04安装Qt5.15.2出现qt.qpa.plugin: Could not load the Qt platform plugin “xcb“的问题解决

    由于Qt6.22太新,我不得不重新安装了Qt,同时安装了Qt6.22和Qt5.15.2,安装完毕后使用Qt6.22是没有问题的,但使用Qt5.15.2运行程序时,提示如下错误 qt.qpa.plugi ...

  5. qt.qpa.plugin: Could not load the Qt platform plugin “linuxfb“ in ““ even though it was found问题解决

    移植好QT 之后,在开发板中运行程序是,会出以下错误. qt.qpa.plugin: Could not load the Qt platform plugin "linuxfb" ...

  6. 出现 qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in 的解决方法

    目录 1. 问题所示 2. 解决方法 3. 补充 1. 问题所示 出现如下问题: (py17)kkjz@kkjz-ThinkStation-P330:yolov5$python main.py QOb ...

  7. 解决qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it was found.

    项目场景: 在使用pyqt5出现问题,让人真的很头疼哇 问题描述 具体问题如下: qt.qpa.plugin: Could not load the Qt platform plugin " ...

  8. Ubuntu20.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“ 问题

    问题描述 python调用matplotlib.pyplot库进行图形绘制时弹出错误提示: qt.qpa.plugin: Could not load the Qt platform plugin & ...

  9. 关于qt.qpa.plugin: Could not load the Qt platform plugin “xcb“的问题

    今天在运行代码的时候出现了以下错误,经查找资料,找到了解决方法. 错误如下: QFactoryLoader::QFactoryLoader() checking directory path &quo ...

最新文章

  1. sparkmllib scala NaiveBayes Demo
  2. 战略支援部队信息工程大学的计算机类,中国顶尖的两大“信息工程”高校翻新,南信大、军信大要崛起?...
  3. SAP offline应用的flush按钮实现
  4. 代码流程图生成器_【进阶Python】第五讲:迭代器与生成器
  5. (转)让Spring自动扫描和管理Bean
  6. 数学速算法64种口诀_小学数学有哪些数学计算技巧?
  7. 6年经验java笔试_不想搞Java了,6年经验去面试10分钟结束,现在Java面试为这么难...
  8. oracle帮助系统,Oracle1 0g扩展的帮助文件的安装
  9. vsftpd+mysql使用
  10. 批量找关键词的软件-再也不用担心找不着 关键词了
  11. JavaScript上传图片方式
  12. 360极速浏览器兼容模式怎么设置在哪
  13. 矢量网络分析仪是什么?矢量网络分析仪的组成
  14. python语言折半查找_c# 折半查找法实现代码
  15. filezilla,filezilla下载文件
  16. [个人笔记]HCIP-Routing Switching-IEEP/H12-223
  17. ProcessDefinition是干这个用的
  18. 【JS】去除“确认重新提交表单”
  19. [错题]Mocha and Railgun
  20. 基于c51单片机的毕业设计——智能温度控制

热门文章

  1. 第14届蓝桥杯模拟赛第一套(超声波+串口)
  2. 基于对python循环常见逻辑错误的总结
  3. 多事之秋:不怕贼偷,就怕惦记
  4. U盘创建win7启动盘
  5. 《诗经·击鼓》:男人赌性命,女人赌身家
  6. 爬取今日头条上的图片
  7. 一个c语言程序有两个源文件,建立多个源文件的C语言程序.pdf
  8. 在VSCode中使用LaTex,语法检测插件grammarly
  9. poi导出excel,去掉左上角绿色三角
  10. io流中read与readline的区别