前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python 报错 qt.qpa.plugin Could not load the Qt platform plugin xcb 解决方案

Python 报错 qt.qpa.plugin Could not load the Qt platform plugin xcb 解决方案

作者头像
为为为什么
发布2024-05-24 09:53:17
2520
发布2024-05-24 09:53:17
举报
文章被收录于专栏:又见苍岚又见苍岚

使用 Opencv 过程中突然 qt 报错,本文记录解决方案。

错误信息

1234

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/python3.11/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 (from /python3.11/site-packages/cv2/qt/plugins), xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

解决方案

问题原理没有弄清楚其实,到现在我都不明白为啥报这个错误

方案一

参考:https://blog.csdn.net/HaoZiHuang/article/details/131262745

在环境变量中添加:

1

export DISPLAY=:0

可以防止代码报错,但是无法显示图片

方案二

参考:https://github.com/NVlabs/instant-ngp/discussions/300

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

12

pip uninstall opencv-pythonpip install opencv-python-headless

解决了我的问题

参考资料

文章链接: https://cloud.tencent.com/developer/article/2420073

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-5-23,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 错误信息
  • 解决方案
    • 方案一
      • 方案二
      • 参考资料
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档