ubuntu 22.04 下python 3.10 使用pyqt 报错,
版本如下:
pyqt5
pyqt5-qt5
pyqt5-sip
opencv-python ==4.10.0.84
QObject::moveToThread: Current thread (0x2afa1be0) is not the object's thread (0x2aff4120).
Cannot move to target thread (0x2afa1be0)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/***/anaconda3/envs/torch/lib/python3.10/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.
换到新的conda 虚拟环境,发现好使,新的环境没有安装pyqt5 相关的包,只安装了opencv-python
最后卸载掉pyqt5,pyqt5-qt5,pyqt5-sip 后,发现错误消失了, 供参考
参考资料:
3 Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题_Linux_脚本之家