[Error]QObject::moveToThread: Current thread (0x565030e64330) is not the object's thread (0x5650304ed930)
在安装pyqt5相关的应用程序时,安装成功后,运行出现以下错误:
QObject::moveToThread: Current thread (0x565030e64330) is not the object's thread (0x5650304ed930).
Cannot move to target thread (0x565030e64330)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/linxu/Apps/Anaconda3/envs/Paddle/lib/python3.6/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.
这里的解决方法有两个:
-
第一个是:因为OpenCV的版本过高,与pyqt5的读写不兼容
pip install opencv-python==4.2.0.32 -i https://pypi.tuna.tsinghua.edu.cn/simple
-
第二个是:可以安装对应的依赖项
sudo apt-get install libxcb-xinerama0
Talk is cheap. Show me the code