一、问题分析:

matplotlib库的调用有问题,可能是找不到wayland插件;

二、解决方法:(没解决)

1、安装qtwayland5

sudo apt-get install qtwayland5

显示qtwayland5 已经是最新版 (5.15.3-1),安装好了。若安装中出现问题,参考:dpkg: 处理软件包 xxx (–configure)时出错解决方法

2、安装好后查看位置

sudo find / -name qtwayland5

/usr/share/doc/qtwayland5

3、Linux添加环境变量,全局生效

/etc/profile []

sudo vim profile
export QT_QPA_PLATFORM=/usr/share/doc/qtwayland5:$PATH
echo $QT_QPA_PLATFORM

空的
在命令行直接

export QT_QPA_PLATFORM=/usr/share/doc/qtwayland5:$PATH

问题:

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, webgl, xcb

安装libxcb-xinerama库:Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

#如果还存在其他依赖库没有安装,也一并安装。
$ sudo apt-get install libxcb-xinerama0

二. 解决方法

重新安装matplotlib ,重启linux
问题消失
出现新问题:

QObject::moveToThread: Current thread (0x99161300) is not the object's thread (0x991308c0). Cannot move to target thread (0x99161300) 
qt.qpa.plugin:Could not load the Qt platform plugin “xcb“

关注pyqt和opencv版本冲突问题
参考以上报错是由于使用 conda 安装 pyqt ,用 pip 安装 opencv ,由版本冲突导致的
具体解决步骤
卸载当前PYQT

conda uninstall pyqt

pip安装pyqt 和opencv

pip install PyQt5
pip install opencv-python-headless

可正常运行

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐