qt5解决This application failed to start because it could not find or load the Qt platform plugin "xc

pyqt5解决This application failed to start because it could not find or load the Qt platform plugin “xcb”.

bug提示信息

This application failed to start because it could not find or load the Qt platform plugin “xcb”.
Available platform plugins are: linuxfb, minimal, offscreen, xcb.
Reinstalling the application may fix this problem. Aborted (core dumped)

问题定位

  1. 定位xcb的路径,通过ldd指令查看xcb库的依赖库状况。这里我们在执行 ldd ~/miniconda3/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so出现了一条信息:

    libxkbcommon-x11.so.0 => not found

qt5解决This application failed to start because it could not find or load the Qt platform plugin "xc

问题原因

Qt-5.12.1更新日志中描述:xkbcommon库被移除,因为基本所以的平台中都默认有这个库了。

[QTBUG-65503] Removed xkbcommon from bundled sources. This library is present on all supported platforms. The minimal required version now is 0.5.0.

解决方案

手动安装libxkbcommon-x11.so.0库即可。
在这里提供ubuntu系统对应的安装指令: sudo apt-get install libxkbcommon-x11-0.