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://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进行降级到指定版本就行了。
问题解决。如果你也遇到这些问题,可以参考参考。欢迎交流。