今天突然发现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日,未经本人运行禁止转载

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐