labelImg
时报错如下:(labelImg) xx@xx-Lenovo-Legion-Y8000:~/SW$ labelImg qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
已放弃 (核心已转储)
linux
下设置环境变量 QT_DEBUG_PLUGINS=1
,
(labelImg) xx@xx-Lenovo-Legion-Y8000:~/SW$ export QT_DEBUG_PLUGINS=1
‵‵‵
然后再启动labelImg
会有详细信息输出:
QFactoryLoader::QFactoryLoader() checking directory path
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqeglfs.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archreq": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 331520
}Got keys from plugin meta data ("eglfs")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archreq": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("linuxfb")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqminimal.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqminimalegl.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {"Keys": [
"minimalegl"
]
},
"archreq": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("minimalegl")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archreq": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqvnc.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archreq": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 331520
}Got keys from plugin meta data ("vnc")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-egl.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-egl"
]
},
"archreq": 0,
"className": "QWaylandEglPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("wayland-egl")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-generic.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-generic.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archreq": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("wayland")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-xcomposite-egl.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3","MetaData": {
"Keys": [
"wayland-xcomposite-egl"
]
},
"archreq": 0,
"className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("wayland-xcomposite-egl")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-xcomposite-glx.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-glx"
]
},
"archreq": 0,
"className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("wayland-xcomposite-glx")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwebgl.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqwebgl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"webgl"
]
},
"archreq": 0,
"className": "QWebGLIntegrationPlugin",
"debug": false,
"version": 331520}
Got keys from plugin meta data ("webgl")
QFactoryLoader::QFactoryLoader() looking at
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqxcb.so"
Found metadata in lib /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archreq": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path
"/home/yangl/SW/anaconda3/envs/labelImg/bin/platforms" ...
Cannot load library /home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件 : 没
有那个文件或目录 )
QLibraryPrivate::loadPlugin failed on
"/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library
/home/yangl/SW/anaconda3/envs/labelImg/lib/python3.6/site-
packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件 : 没
有那个文件或目录 )"
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl,
wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
已放弃 ( 核心已转储 )
libxcb-xinerama.so.0
,需要安装libxcb-xinerama0
,安装后可正常打开labelImg
libxcb-xinerama.so.0: 无法打开共享对象文件 : 没有那个文件或目录
(labelImg) xx@xxx-Y8000:~/SW$ sudo apt-get install libxcb-xinerama0
安装后可在/usr/lib
目录下找到libxcb-xinerama.so.0
,
(base) xxx@xxx-rob:/usr/lib$ find ./ -name libxcb-xinerama.so.0
./x86_64-linux-gnu/libxcb-xinerama.so.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/lx/sw/anaconda3/envs/labelme/lib/python3.8/site- packages/cv2/qt/plugins" even though it was found.
解决
qt的bug,有可能是opencv中的xcb不兼容 直接 将/home/lx/sw/anaconda3/envs/labelme/lib/python3.8/site-packages/cv2/qt/plugins删 除即可