文章目录
- 报错提示
- 查看报错原因
- 安装
- 报错
报错提示
按照步骤安装完labelimg后,在终端输入labelImg
后,报错:
(labelimg) root@interactive59753:~# labelImg
………………
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/root/anaconda3/envs/labelimg/bin/platforms" ...
Cannot load library /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libfontconfig.so.1: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libfontconfig.so.1: cannot open shared object file: No such file or directory)"
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.
Aborted (core dumped)
查看报错原因
首先,终端输入vim ~/.bashrc
,在最后一行输入export QT_DEBUG_PLUGINS=1
,然后source ~/.bashrc
,最后再输入labelImg
,就会在终端输出报错信息,如图所示:
这里cd /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms
,然后输入ldd libqxcb.so
,查看缺少的库,如下所示:
(labelimg) root@interactive59753:~/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/pl
atforms# ldd libqxcb.so
linux-vdso.so.1 (0x00007fff17fca000)
libQt5XcbQpa.so.5 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libQt5XcbQpa.so.5 (0x00007fba3a831000)
libfontconfig.so.1 => not found
libfreetype.so.6 => not found
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fba3a80a000)
libQt5Gui.so.5 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libQt5Gui.so.5 (0x00007fba39f35000)
libQt5DBus.so.5 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libQt5DBus.so.5 (0x00007fba39ca6000)
libQt5Core.so.5 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libQt5Core.so.5 (0x00007fba3945d000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fba393d5000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fba393b2000)
libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fba393ad000)
libxcb-icccm.so.4 => not found
libxcb-image.so.0 => not found
libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fba393a6000)
libxcb-keysyms.so.1 => not found
libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007fba39393000)
libxcb-render-util.so.0 => not found
libxcb-render.so.0 => not found
libxcb-shape.so.0 => not found
libxcb-sync.so.1 => /lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fba39387000)
libxcb-xfixes.so.0 => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007fba3937d000)
libxcb-xinerama.so.0 => /lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007fba39378000)
libxcb-xkb.so.1 => not found
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fba3934e000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007fba39337000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fba391fa000)
libSM.so.6 => not found
libICE.so.6 => not found
libxkbcommon-x11.so.0 => not found
libxkbcommon.so.0 => not found
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fba391f2000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fba39010000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fba38ec1000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fba38ea6000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fba38cb4000)
libfontconfig.so.1 => not found
libfreetype.so.6 => not found
libxcb-icccm.so.4 => not found
libxcb-image.so.0 => not found
libxcb-keysyms.so.1 => not found
libxcb-render-util.so.0 => not found
libxcb-render.so.0 => not found
libxcb-shape.so.0 => not found
libxcb-xkb.so.1 => not found
libSM.so.6 => not found
libICE.so.6 => not found
libxkbcommon-x11.so.0 => not found
libxkbcommon.so.0 => not found
libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fba38ca9000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fba38b7f000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fba38b2e000)
libicui18n.so.56 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libicui18n.so.56 (0x00007fba38695000)
libicuuc.so.56 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libicuuc.so.56 (0x00007fba382db000)
libicudata.so.56 => /root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/./../../lib/libicudata.so.56 (0x00007fba368f8000)
/lib64/ld-linux-x86-64.so.2 (0x00007fba3ad8e000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fba36840000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fba3680c000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fba36806000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fba367fc000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fba36789000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fba366da000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fba366c0000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fba366b6000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fba3668b000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fba3666a000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fba3654c000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fba36529000)
然后把报错提示的not found的都安装一遍,就可以了。
安装
比如对于libfontconfig.so.1 => not found
,我这里安装的是apt-get install libfontconfig1
,这个是百度得到的结果,安装完后重新ldd,看还有哪一些是not found 的,一个个安装就可以了。
这里可能会有疑问说,怎么找到就是要安装这些包,说实话,我也不知道,我自己一个个百度的,那就大家自己百度吧。这里看到有一个博文写了相关的:https://blog.csdn.net/lyfwill/article/details/88958738,大家可以自己甄别,反正我试过我不能用。
报错
解决完上面的,又来一个报错
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/root/anaconda3/envs/labelimg/bin/platforms" ...
loaded library "/root/anaconda3/envs/labelimg/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display :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.
Aborted (core dumped)
这个报错不会解决,试了很多方法都不行,什么链接xshell什么的都不行。