macOS 下 opencv-python 与 PyQt5 会冲突

macOS 下 opencv-python 与 PyQt5 会冲突,第1张

报错如下

:objc[93743]: Class QMacAutoReleasePoolTracker is implemented in both /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/cv2/.dylibs/QtCore (0x10dc94700) and /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11f2e10f8). One of the two will be used. Which one is undefined.
objc[93743]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/cv2/.dylibs/QtCore (0x10dc94778) and /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11f2e1170). One of the two will be used. Which one is undefined.
objc[93743]: Class KeyValueObserver is implemented in both /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/cv2/.dylibs/QtCore (0x10dc947a0) and /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11f2e1198). One of the two will be used. Which one is undefined.
objc[93743]: Class RunLoopModeTracker is implemented in both /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/cv2/.dylibs/QtCore (0x10dc947f0) and /Users/nanpuyue/build/FanselineImageToolbox/Source Code/venv/lib/python3.8/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11f2e11e8). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7f9a6ee1c450) is not the object’s thread (0x7f9a6efa4cb0).

使用cv2.waitKey(1)读入不了 解决方法

安装 opencv-python-headless 代替 opencv-python:

pip3 uninstall opencv-python
pip3 install opencv-python-headless

最后成功解决

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/722975.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-26
下一篇 2022-04-26

发表评论

登录后才能评论

评论列表(0条)

保存