报错提示
按照步骤安装完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