Could not load the Qt platform plugin “xcb“ in...问题解决

在Linux上用Vscode调试MAPPO代码时碰到“Could not load the Qt platform plugin “xcb” in…”问题,问题详细描述如下:

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/cloris/anaconda3/envs/py37/lib/python3.7/site-packages/cv2/qt/plugins" 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: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

报错原图:
请添加图片描述网上查找解决方法如下:
在终端输入如下代码:

export QT_QPA_PLATFORM=offscreen

成功解决问题(他不清楚为什么,我也不清楚 T.T)。

里面还有另一种解决办法,如下:
可能是open-cv的包引起的,安装opencv-python-headless就工作了:

pip uninstall opencv-python
pip install opencv-python-headless

这个我没用到,如果前面那种方法没有解决,可以试试这个。

参考:
[1] github:https://github.com/NVlabs/instant-ngb/discussions/300

猜你喜欢

转载自blog.csdn.net/weixin_41794514/article/details/128578166