深度学习(17):ubuntu18.04 labelme安装与qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ 报错解决

1 报错

(yolov5py37) meng@meng:~$ labelme
[INFO   ] font_manager:__init__:996 - Failed to extract font properties from %s: %s
[INFO   ] font_manager:__init__:996 - Failed to extract font properties from %s: %s
[INFO   ] font_manager:_rebuild:1337 - generated new fontManager
[INFO   ] font_manager:_rebuild:1337 - generated new fontManager
[INFO   ] __init__:get_config:71 - Loading config file from: /home/meng/.labelmerc
QObject::moveToThread: Current thread (0x55939784e8f0) is not the object's thread (0x5593981fbbe0).
Cannot move to target thread (0x55939784e8f0)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/meng/anaconda3/envs/yolov5py37/lib/python3.7/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, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

已放弃 (核心已转储)

深度学习(17):ubuntu18.04 labelme安装与qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ 报错解决_第1张图片

(1)如上图所示,2-5行的错误(第一个红框),执行下面“2 安装”的“(2)安装依赖库:”即可解决

(2)第二个红框是qt和opencv安装在同一个系统中时可能会遇到的错误,解决办法是把python环境里面的qt插件删除即可,这样qt在找自己插件的时候会自动跳过与opencv冲突的插件,github上面有人说是qt和opencv的bug

我这里将/home/meng/anaconda3/envs/yolov5py37/lib/python3.7/site-packages/cv2/qt/plugins备份后删除:

深度学习(17):ubuntu18.04 labelme安装与qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ 报错解决_第2张图片

 github issue链接:https://github.com/wkentaro/labelme/issues/842

下图的插件目录和我本次的不一样,大家找到报错里面的目录即可

深度学习(17):ubuntu18.04 labelme安装与qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ 报错解决_第3张图片

深度学习(17):ubuntu18.04 labelme安装与qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ 报错解决_第4张图片

2 安装

(注: 这里安装的是python3版本的)

(1)创建虚拟环境或者不创建

(2)安装依赖库

#其他库
sudo apt-get install libx11-dev libxext-dev libxtst-dev
sudo apt-get install mesa-common-dev x11proto-gl-dev mesa-common-dev:i386

(3)安装qt5

#qt5
pip install pyqt5

(4)安装labelme

我在python3.7的虚拟环境安装的,使用命令:

pip install pyqt5

要是在base环境安装,可能需要使用pip3:

pip3 install labelme

#报错的话可以试试:
#pip3 install --upgrade pip
#pip3 install labelme

3 使用

深度学习(17):ubuntu18.04 labelme安装与qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ 报错解决_第5张图片

 

你可能感兴趣的:(ubuntu,python,linux,深度学习,labelme)