PyQt5 qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it was found.
Problem:
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)
Solution:
sudo apt-get install libxcb-xinerama0
在使用visdom进行可视化的时候,遇到了如下错误:
-
Setting up a new session...
-
[Errno 111] Connection refused
-
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.
求助于搜索引擎,发现网上问这个问题的挺多的,真是八仙过海各显神通。
首先使用了
export QT_DEBUG_PLUGINS=1
然后重新运行程序,看到是
-
Got keys from plugin meta data ("xcb")
-
QFactoryLoader::QFactoryLoader() looking at "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0"
-
"Failed to extract plugin meta data from '/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0'"
-
not a plugin
-
QFactoryLoader::QFactoryLoader() looking at "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0.0.0"
-
"Failed to extract plugin meta data from '/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0.0.0'"
-
not a plugin
-
QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/bin/platforms" ...
-
Cannot load library /usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件: 没有那个文件或目录)
-
QLibraryPrivate::loadPlugin failed on "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /usr/local/lib/python3.7/site-packages/PyQt5/Qt/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.
尝试了各种方法,好几种都不凑效,最终解决方案:
apt-get install libxcb-xinerama0
注意最后有个数字0
上一篇: Mockito单元测试
下一篇: 用CSS3设置P的对齐方式