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)
问题定位
- 定位
xcb
的路径,通过ldd
指令查看xcb
库的依赖库状况。这里我们在执行ldd ~/miniconda3/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so
出现了一条信息:libxkbcommon-x11.so.0 => not found
。
问题原因
在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
.