cv2 undefined symbol: g_date_copy (or qt.qpa.plugin: Could not load..)解决

本文讲述了在Ubuntu环境下使用Qt5创建GUI时遇到的QObject线程问题和cv2库undefinedsymbol:g_date_copy错误。通过查找资料,发现可能是OpenCV版本不兼容导致,解决方案包括检查OpenCV与PyQt5版本并降级到opencv-python==3.4.6.27。

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

cv2 undefined symbol: g_date_copy

or qt.qpa.plugin: Could not load

问题背景:
这次就是想用Qt5在Ubuntu上做一个GUI,结果一运行就报这个:

  • QObject::moveToThread: Current thread (0x7fc0f7435300) is not the object’s thread (0x7fc0f9f02cc0).
    Cannot move to target thread (0x7fc0f7435300)
    qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
  • 然后一顿查,可能的问题就是:1.cv2.imshow 可能会让GUI报错。(https://qiita.com/LemniscaterN/items/dfcda303677ca2ebf049)
  • 2.可能是 cv2 和 PyQt5 底层用了不同版本的 opencv。所以要降级opencv版本。于是就有很多人说PyQt5==5.15.2和
    opencv-python-4.3.0.36这两个配置版本解决了他们的问题。

然鹅。我并没有,然后报了个错误:
cv2 undefined symbol: g_date_copy 。大概是:symbol lookup error: /home/chujie/anaconda3/lib/libgobject-2.0.so.0: undefined symbol: g_date_copy

尝试:

  • 我先试了一下这个:https://blog.youkuaiyun.com/zjchenchujie/article/details/103022106 结果没什么效果。
  • 然后就看到这里:https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/67。
  • 原话:Hey, this is because the latest version of openCV doesn’t work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
    You will need to uninstall the latest version first. pip3 uninstall opencv-python 就是说将opencv-python进行降级到指定版本就行了。
    问题解决。如果你也遇到这些问题,可以参考参考。欢迎交流。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值