bug -- Pyqt5+openCV报错(QObject::moveToThread:)

在Ubuntu21系统中,使用Python3.9运行基于PyQT和OpenCV的GUI程序时遇到了错误。错误信息包括线程无法移动和Qtplatformplugin加载失败。问题的根本原因是opencv-python版本与系统或Python版本不匹配。通过降级opencv-python到4.1.2.30版本解决了此问题,具体操作为下载对应版本的whl文件并使用pip进行本地安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错什么线程无法移动,妈个鸡狗屁不是

使用pyqt和opencv的做的GUI程序中出线的问题

就是opcv-python的版本对不上

系统py版本(conda)报错
Ubuntu213.9Cannot move to target thread
QObject::moveToThread: Current thread (0x5560b72388b0) is not the object's thread (0x5560b74641b0).
Cannot move to target thread (0x5560b72388b0)


这个报错是上面的报错引起的
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/fly/anaconda3/envs/video/lib/python3.9/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版本,这里推荐降python(血泪记忆)

opencv-python4.1.2.30
把上面的文件下载,本地安装即可(虚拟环境切换到相应的虚拟环境)

pip install opencv_python-4.1.2.30-cp38-cp38-manylinux1_x86_64.whl 

成功解决

在这里插入图片描述

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值