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

即可解决

你可能感兴趣的:(macos 中先安装了pyqt5再安装opencv出现的QtCore冲突问题)