macos 中先安装了pyqt5再安装opencv出现的QtCore冲突问题

小白最近在做一个播放器
在配置好QtDesigner QtGUI
确认正确安装了pyqt5 和 opencv后
出现了这个问题`

objc[21114]: Class QMacAutoReleasePoolTracker is implemented in both /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x117554700) and /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11b774030). One of the two will be used. Which one is undefined.
objc[21114]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x117554778) and /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11b7740a8). One of the two will be used. Which one is undefined.
objc[21114]: Class KeyValueObserver is implemented in both /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x1175547a0) and /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11b7740d0). One of the two will be used. Which one is undefined.
objc[21114]: Class RunLoopModeTracker is implemented in both /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x1175547f0) and /Users/danieltang/opt/anaconda3/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11b774120). One of the two will be used. Which one is undefined.

这是因为PyQt5 and OpenCV 有相同的 libraries; 如何避免二者的冲突呢
首先卸载已经安装的opencv

pip uninstall opencv-contrib-python

然后安装一个headless版

pip install opencv-contrib-python-headless

安装太慢可以使用 清华源:https://pypi.tuna.tsinghua.edu.cn/simple

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python-headless

即可解决

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值