Python:导入OpenCV时出错

时间:2015-05-19 16:18:29

标签: python opencv homebrew

我用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

我该如何解决这个问题?

1 个答案:

答案 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看起来需要至少版本34.0.0的libpng,而你的版本是33.0.0。我希望更新libpng可以解决问题。