PyQt5和OpenCV有类似的库;如何避免两者之间的冲突?

2024-02-29

我在同一个 conda 虚拟环境中拥有 PyQt5 和 OpenCV。

opencv-python==3.4.1.15    
PyQt5==5.10.1    

每当我运行 PyQt5 应用程序时,我都会收到许多如下警告:

objc[7992]: Class QCocoaPageLayoutDelegate is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109ae0290) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x10a387f20). One of the two will be used. Which one is undefined.
objc[7992]: Class QCocoaPrintPanelDelegate is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109ae0308) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x10a387f70). One of the two will be used. Which one is undefined.    
objc[7992]: Class QCocoaApplicationDelegate is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109ae0010) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x10c6ed480). One of the two will be used. Which one is undefined.    
objc[7992]: Class QNSApplication is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109adffc0) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x10c6ed4d0). One of the two will be used. Which one is undefined.    
objc[7992]: Class QCocoaMenuLoader is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109adff70) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x10c6ed570). One of the two will be used. Which one is undefined.    
objc[7992]: Class QNSImageView is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109ae0330) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x10c6ed660). One of the two will be used. Which one is undefined.    
objc[7992]: Class QNSStatusItem is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109ae0380) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x10c6ed6b0). One of the two will be used. Which one is undefined.    
objc[7992]: Class QNSOpenSavePanelDelegate is implemented in both /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/cv2/.dylibs/QtGui (0x109ae0150) and /Users/alexryan/miniconda3/envs/qacker/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib (0x10c6ed750). One of the two will be used. Which one is undefined.

处理这个问题的适当方法是什么?


我通过使用 GUI 卸载 opencv 并安装无头版本解决了该问题:

pip 卸载 opencv-contrib-python

pip 安装 opencv-contrib-python-headless

opencv中的namedWindow函数仍然有效。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PyQt5和OpenCV有类似的库;如何避免两者之间的冲突? 的相关文章

随机推荐