当前位置: 代码迷 >> 综合 >> QObject::moveToThread: Current thread is not the object`s thread. Cannot move to target thread
  详细解决方案

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

热度:39   发布时间:2023-10-25 08:15:14.0

如果遇到这种情况,那么说明你的ubuntu环境下已经安装了QT了。其实这个只是一个warning,我们完全可以忽略掉。但是如果你有强迫症的话,而且不需要QT的话,那么可以继续往下看了,但是如果你平时需要QT,那么就不要看下去了,就继续忍受python-opencv报的warning错了,其实也没啥。或者是自己使用QT去配置opencv,而不是去使用python-opencv。
如果你像我一样,只是傻逼一样的安装了QT,但是不用QT的话(只是单纯的装了QT而已),然后你也想用python-opencv,并且还不能忍受python-oopencv报的这个warning:

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

那么我们就来解决这个问题。其实也很简单。我通过百度加google得到的结果是python-opencv和qt之间有点小小的bug。所以我们只需要卸载掉QT就好了(所以如果你不想卸载掉QT,就别往下看了!!!)。
卸载QT的方法很简单直接看下下文这个链接:
ubuntu卸载QT
注意啊,卸载完以后需要继续执行下面这个操作,才能真正的把QT给卸载干净。所以接下来继续执行这个指令:

sudo apt-get autoremove qt5-default qtcreator

好了,这样你的ubuntu的QT已经被卸载干净了,然后你再去使用python-opencv的时候就不会有那个warning了。
但是请注意:如果你不想卸载掉QT,就千万别去瞎搞,我这里装QT,仅仅是蠢,没有什么实际的用处(我现在还没有去用QT,说不定后期就会用了)。

  相关解决方案