OpenCV:qt.qpa.plugin: Could not load the Qt platform plugin “xcb”

一、问题描述

具体报错如下:

qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in*************/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

后来通过debug,定位到是opencv中使用cv2.imshow()的问题,于是LZ猜测可能是opencv的问题,每次找bug都像在破案一样。

二、解决方法

说实话这个问题LZ之前没有碰到过,也只有满世界百度和google,但是发现方法都不work,后面偶然间发现一个博客说可能是opencv的一个bug,于是LZ就重新pip install了opencv

(CenterTrack) root@70e7a5ca0a8d:/# pip install opencv-python==4.1.0.25
Collecting opencv-python==4.1.0.25
  Downloading opencv_python-4.1.0.25-cp36-cp36m-manylinux1_x86_64.whl (26.6 MB)
     |################################| 26.6 MB 146 kB/s 
Requirement already satisfied: numpy>=1.11.3 in /root/anaconda3/envs/CenterTrack/lib/python3.6/site-packages (from opencv-python==4.1.0.25) (1.19.2)
Installing collected packages: opencv-python
  Attempting uninstall: opencv-python
    Found existing installation: opencv-python 4.4.0.44
    Uninstalling opencv-python-4.4.0.44:
      Successfully uninstalled opencv-python-4.4.0.44

结果问题解决,其他安装依赖库的方法也都尝试了,但是并没有解决LZ的问题,所以就不写在博客里了,并且每个人遇到相同的报错,原因也有可能不一样,所以多多尝试才可以啊。

LZ现在的梦想就是身体健康,万事如意,哈哈哈哈哈,不知道为啥突然想说这个。。。

三、参考链接:

https://stackoverflow.com/questions/60032540/opencv-cv2-imshow-is-not-working-because-of-the-qt

相关推荐
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页