最近在使用 conda 环境踩了个坑,运行 opencv 项目时弹出满屏的 Qthread 报错。

网上的解决方法大多是把 opencv-python 降级,或者 sudo 用包管理器安装到系统,但是都没有很彻底或者说优雅地解决问题。

问题描述

python 3.8 (conda) 环境下,运行 opencv 项目出现报错:QObject::moveToThread: Current thread(…) is not the object`s thread. Cannot move to target thread(…)。

问题溯源

以上报错是由于使用 conda 安装 pyqt ,用 pip 安装 opencv ,由版本冲突导致的:

如果您使用 Anaconda 虚拟环境并同时执行 conda install pyqtpip install opencv-python。 opencv-python 会在两个 PyQt 版本之间产生冲突并导致错误。

解决方案

卸载当前用 conda 装的 PyQt:

conda uninstall pyqt

通过 pip 安装 PyQt :

pip install PyQt5
pip install opencv-python

参考

解决方案参考 stackoverflow 答主 a_guest :原帖地址

QObject::moveToThread: Current thread(...) is not the object`s thread. Cannot move to target thread(相关推荐

  1. QObject::moveToThread: Current thread (0x5651ebdaa180) is not the object’s thread (0x5651eba7e2a0).

    报错信息: QObject::moveToThread: Current thread (0x5651ebdaa180) is not the object's thread (0x5651eba7e ...

  2. QObject::moveToThread: Current thread is not the object`s thread. Cannot move to target thread

    报错:Opencv无法显示图像,报错QObject::moveToThread: Current thread is not the object's thread . Cannot move to ...

  3. Qt跨线程使用moveToThread的注意事项(Cannot move to target thread )

    考虑以下场景: 主线程(Qt主事件循环)中跨线程调用某个函数func(如QtConcurrent::run),在func中又创建了另一个线程,从而将业务逻辑丢到该线程中 class CrossThre ...

  4. 记录opencv的 QObject::moveToThread: Current thread(...) is not the object`s thread 错误

    这个错误主要是在qt库的加载上,在安装的opencv-python工具包下有个qt文件夹,这个文件夹里面的文件估计是要来加载qt的,要是这个里面的qt库的版本和pip install pyqt5所使用 ...

  5. QObject::moveToThread:

    QObject::moveToThread:Current thread is not the object`s thread. Cannot move to target thread 大部分说法说 ...

  6. 重点:怎样正确的使用QThread类(注:包括推荐使用QThread线程的新方法QObject::moveToThread)...

    背景描述: 以前,继承 QThread 重新实现 run() 函数是使用 QThread唯一推荐的使用方法.这是相当直观和易于使用的.但是在工作线程中使用槽机制和Qt事件循环时,一些用户使用错了.Qt ...

  7. java之Thread.sleep(long)与object.wait()/object.wait(long)的区别及相关概念梳理(good)

    一.Thread.sleep(long)与object.wait()/object.wait(long)的区别 sleep(long)与wait()/wait(long)行为上有些类似,主要区别如下: ...

  8. 【Qt】QObject::moveToThread 总结

    原型 void QObject::moveToThread(QThread *targetThread) 功能 将QObject及其孩子移动到 指定线程(targetThread)中.它的事件将在ta ...

  9. error:The calling thread cannot access this object because a different thread owns it解决方法

    WPF 由于其他线程拥有此对象,因此调用线程无法对其进行访问. 一:WPF线程模型. 除非已经对WPF体系结构非常熟悉,对多线程开发很了解,不然我们在与WPF打交道的时候经常会遇到这样一个异常: 由于 ...

  10. Qt多线程之继承QObject(moveToThread方式)

    Qt多线程有两两种方式,第一种继承QThread,复写run()函数,但是run()和main()类似,run()函数才是子线程的入口函数,所以在设计到类的操作时,必须把对象或者指针放在run函数里面 ...

最新文章

  1. Linux日常之允许或禁止指定用户或IP进行SSH登录
  2. asp.net 2.0 设置表格高度为100%.
  3. 变换例题_用初等变换求逆矩阵的小小解释
  4. 通过结构体某个成员的地址计算结构体首地址
  5. 浅谈-LINUX 操作系统启动过程
  6. 图例放在图的外面_手把手教你绘制多个置信区间的森林图
  7. 麦咖啡McAfee 8.8企业版规则设置(高级篇)
  8. Hutool使用总结(VIP典藏版)
  9. MFC 添加静态图片(Picture Control控件)
  10. Qt之自定义QLineEdit右键菜单
  11. android TV 插入U盘检测
  12. GoLand:Cannot resolve symbol
  13. 产品读书《极简生活法则》
  14. Multithreading and Synchronization
  15. TortoiseSVN安装失败——Please install the universal CRT first
  16. Adobe Premiere基础特效(卡点和转场)(四)
  17. SAP UI5 应用开发教程之六十九 - 如何从 SAP UI5 Not Found 页面跳转回到正常的应用页面试读版
  18. vue + threejs实战,实现3D 360度 旋转查看物体
  19. Java并发(四)BlockingQueue的使用
  20. ubuntu 16.04无法locate boot-repair的解决方法

热门文章

  1. 画皮用计算机怎么弹山妖,山妖(翻自 小星星Aurora)歌词
  2. 创新实训(11)——推荐系统实现之基于流行度和新鲜度的推荐
  3. 从壹开始前后端分离【重要】║最全的部署方案 最丰富的错误分析
  4. 【汇正财经】短线交易行为的构成问题
  5. SQL增删改查知识点总结
  6. mysql添加索引报错1170 -BLOB/TEXT column ‘xx‘ used in key specification without a key length分析及解决
  7. IE编程1(.net)——读取IE窗口信息
  8. live2d碰撞_Euclidの基本について
  9. 【技能图谱免费下载】进阶数据库工程师 你需要Get这些技能
  10. java键盘事件无反应_键盘事件,没反应