解决Warning:QObject::moveToThread: Current thread (0x5591ae5f17f0) is not the object‘s thread

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

本人环境:Ubuntu20.04, python3.8.8, opencv-python=4.5.4.60

1. 问题产生

示例代码如下

import cv2
img_path = "Camera_img/test.jpg"
img = cv2.imread(img_path)
    
print("1")
cv2.namedWindow("img", cv2.WINDOW_NORMAL)
print("2")
cv2.imshow("img", img)
print("3")
cv2.waitKey(10)
print("4")
cv2.destroyAllWindows()

运行时在1和2之间会出现大量的QObject::moveToThread: Current thread (0x5591ae5f17f0) is not the object’s thread

2.解决办法

  1. 降低OpenCV版本
    尝试了,没解决问题

  2. 卸载qt
    查看conda环境,发现有qt,随后卸载

    conda uninstall qt
    

    卸载过程中发现报错
    RemoveError: ‘setuptools’ is a dependency of conda and cannot be removed from conda’s operating environment.

    随后卸载setuptools后重新卸载qt

    pip uninstall setuptools
    conda update --force conda
    conda uninstall qt
    pip install setuptools
    

    问题解决

Warning:conda update --force conda会卸载掉部分包,需要重新安装

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值