微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

导入cv2时出现python importError

我已经使用brew安装了opencv3,但在执行import cv2时遇到了importError

>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>

ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib

  Referenced from: /usr/local/Cellar/opencv/2.4.12_2/lib/libopencv_highgui.2.4.dylib
  Reason: Incompatible library version: libopencv_highgui.2.4.dylib requires version 37.0.0 or later, but libpng16.16.dylib provides version 35.0.0

有人可以帮忙吗?

解决方法:

以下解决了这个问题.

brew uninstall --force brew-cask
brew uninstall --force opencv
brew doctor
brew tap homebrew/science
brew install opencv

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐