我用Homebrew安装了opencv。我收到以下错误-

>>> 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/lib/libpng16.16.dylib
  Referenced from: /usr/local/Cellar/opencv/2.4.11_1/lib/libopencv_highgui.2.4.dylib
  Reason: Incompatible library version: libopencv_highgui.2.4.dylib requires version 34.0.0 or later, but libpng16.16.dylib provides version 33.0.0

我该如何解决?

最佳答案

Library not loaded: /usr/local/lib/libpng16.16.dylib

^由于某种原因尚未加载libpng
Referenced from: /usr/local/Cellar/opencv/2.4.11_1/lib/libopencv_highgui.2.4.dylib

^ highgui尝试加载它。
Reason: Incompatible library version

^ libopencv_highgui看起来至少需要libpng 34.0.0版本,而您的版本是33.0.0。我希望更新libpng应该可以解决问题。

关于python - Python:导入OpenCV时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30330990/

10-12 18:42