欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

PyQt5 qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it was found.

程序员文章站 2022-04-26 16:05:09
...

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进行可视化的时候,遇到了如下错误:

 
  1. Setting up a new session...

  2. [Errno 111] Connection refused

  3. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

  4. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

  5.  
  6. 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

然后重新运行程序,看到是

 
  1. Got keys from plugin meta data ("xcb")

  2. QFactoryLoader::QFactoryLoader() looking at "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0"

  3. "Failed to extract plugin meta data from '/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0'"

  4. not a plugin

  5. QFactoryLoader::QFactoryLoader() looking at "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0.0.0"

  6. "Failed to extract plugin meta data from '/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libxcb-xinerama.so.0.0.0'"

  7. not a plugin

  8. QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/bin/platforms" ...

  9. Cannot load library /usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件: 没有那个文件或目录)

  10. 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

  11. .0: 无法打开共享对象文件: 没有那个文件或目录)"

  12. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

  13. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

  14.  
  15. 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

相关标签: PyQt PyQt5