广告区
广告区
关注本站官方公众号:程序员总部,领取三大福利!
福利一:python和前端辅导
福利二:进程序员交流微信群,专属于程序员的圈子
福利三:领取全套零基础视频教程(python,java,前端,php)
发布于2020-06-09 06:22 阅读(2500) 评论(0) 点赞(18) 收藏(1)
本文用于记录一下解决问题的过程,若只需解决方法可以直接看文章最后部分
本文出现的问题应该是在Mac上才会出现
系统:Mac os 10.14
pyqt/opencv安装均在anaconda虚拟环境下进行
在使用opencv以及pyqt时出现以下错误
objc[2623]: Class QMacAutoReleasePoolTracker is implemented in both /anaconda3/envs/face/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x116bc90f8) and /anaconda3/envs/face/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x11ef14700). One of the two will be used. Which one is undefined.
objc[2623]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /anaconda3/envs/face/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x116bc9170) and /anaconda3/envs/face/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x11ef14778). One of the two will be used. Which one is undefined.
objc[2623]: Class KeyValueObserver is implemented in both /anaconda3/envs/face/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x116bc9198) and /anaconda3/envs/face/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x11ef147a0). One of the two will be used. Which one is undefined.
objc[2623]: Class RunLoopModeTracker is implemented in both /anaconda3/envs/face/lib/python3.7/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (0x116bc91e8) and /anaconda3/envs/face/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x11ef147f0). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7fcc2cb0a6c0) is not the object's thread (0x7fcc2f06cf20).
Cannot move to target thread (0x7fcc2cb0a6c0)
You might be loading **two sets of Qt binaries** into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "**/anaconda3/envs/face/lib/python3.7/site-packages/cv2/qt/plugins**" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: cocoa, minimal, offscreen, webgl.
在路径/anaconda3/envs/face/lib/python3.7/site-packages/cv2/下删除qt文件夹即可
但是这么做存在一定问题:在删除qt文件夹后正常的只含有cv2的程序无法正常运行(显然是拆东墙补西墙)
但是应急的话应该是没问题的
出现问题的原因在于mac版本下安装的opencv包含有一些qt的头文件与pyqt中的发生了冲突,导致无法正确导入相应的包,需要将其更换
按照以下步骤进行
pip uninstall opencv-python
pip install opencv-contrib-python-headless
至此应该就可以同时正常运行cv2和pyqt了
关注本站官方公众号:程序员总部,领取三大福利!
福利一:python和前端辅导
福利二:进程序员交流微信群,专属于程序员的圈子
福利三:领取全套零基础视频教程(python,java,前端,php)
关注公众号回复python,免费领取 全套python视频,回复充值+你的账号,免费为您充值1000积分
作者:9384vfnv
链接:https://www.pythonheidong.com/blog/article/410902/33fdf4203f66748d954f/
来源:python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!