Jaydev
Jaydev

Reputation: 1812

python importError while importing cv2

I have installed opencv3 using brew, but am facing importError while executing import cv2

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

Can someone help ?

Upvotes: 4

Views: 2271

Answers (1)

Jaydev
Jaydev

Reputation: 1812

The following resolved the problem.

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

Upvotes: 7

Related Questions