matplotlib qt wsl ubuntu qt5

aro*_*rod 1 matplotlib qt5 jupyter

使用 jupyter 笔记本时遇到问题,并尝试使用 matplotlib 进行简单的绘图。

犯了很多错误, ImportError: Failed to import any qt binding

还尝试在我的 WSL Ubuntu Linux 中安装一些库 sudo apt-get install libgl1-mesa-glx 但没有解决问题: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

安装其他软件包后,我只从 Jupyter 收到一条消息Kernel is dead

问题如何解决?

aro*_*rod 5

TL;博士;

sudo apt-get install libxkbcommon-x11-0

更多细节:

经过大量谷歌搜索后,为我指明正确方向的是(这个网站)[ https://forum.qt.io/topic/93247/qt-qpa-plugin-could-not-load-the-qt-platform -plugin-xcb-in-even-though-it-was-found/3] SGaist 的评论

$ export QT_DEBUG_PLUGINS=1
$ jupyter qtconsole
Run Code Online (Sandbox Code Playgroud)

显示: .../site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)

可以安装它:

sudo apt-get install libxkbcommon-x11-0
Run Code Online (Sandbox Code Playgroud)

然后一切都成功了......!

希望这可以帮助某人...