我写了一个程序,使用 pyqt5 和 opencv-python 从相机捕捉视频,但是当我运行这个程序时,我得到:
objc[35814]: Class QCocoaPageLayoutDelegate is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c5c0) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x11576c468). One of the two will be used. Which one is undefined.
objc[35814]: Class QCocoaPrintPanelDelegate is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c638) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x11576c4e0). One of the two will be used. Which one is undefined.
objc[35814]: Class QCocoaApplicationDelegate is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c340) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x117b03b88). One of the two will be used. Which one is undefined.
objc[35814]: Class QNSApplication is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c2f0) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x117b03bd8). One of the two will be used. Which one is undefined.
objc[35814]: Class QCocoaMenuLoader is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c2a0) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x117b03d18). One of the two will be used. Which one is undefined.
objc[35814]: Class QNSImageView is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c660) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x117b03e08). One of the two will be used. Which one is undefined.
objc[35814]: Class QNSStatusItem is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c6b0) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x117b03e58). One of the two will be used. Which one is undefined.
objc[35814]: Class QNSOpenSavePanelDelegate is implemented in both /Users/username/python_env/py3env/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x11439c480) and /Users/username/python_env/py3env/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x117b03ef8). One of the two will be used. Which one is undefined.
cv2 和 pyqt5 冲突。
操作系统是macOS High Sieera,python版本是3.5.2,用venv搭建了一个虚拟环境,在里面执行“pip install pyqt5”、“pip install opencv-python”,库是安装。
在ubuntu和windows下都正常,没有报错,只有mac不行。
如何解决错误?
最佳答案
我的代码遇到了同样的问题。是因为opencv和pyqt5的冲突。我能够通过安装 opencv 的 headless 版本来解决问题
关于python - macOS : PyQt5 conflict with opencv-python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57571101/