解决opencv-python和PyQt5相冲突问题(qt.qpa.plugin: Could not load the Qt platform plugin “xcb“)

文章目录

    • 1、系统环境
    • 2、python版本
    • 3、具体报错
    • 4、解决方法

今天突然发现opencv-python好像和PyQt5冲突了,一直加载不了opencv-python下Qt“xcb”插件

1、系统环境

Linux shier 5.18.16-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 03 Aug 2022 11:25:04 +0000 x86_64 GNU/Linux

2、python版本

python3.8.0

3、具体报错

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/shier/.conda/envs/qt/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.

4、解决方法

卸载opencv-python,安装opencv-python-headless

pip uninstall opencv-python 
pip install opencv-python-headless

完美解决

本帖写于2022年8月16日,未经本人运行禁止转载

你可能感兴趣的:(linux,opencv,python,qt)