Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 985
Jaydev Avatar asked Mar 13 '23 17:03

Jaydev


1 Answers

The following resolved the problem.

brew uninstall --force brew-cask
brew uninstall --force opencv
brew doctor
brew tap homebrew/science
brew install opencv
like image 146
Jaydev Avatar answered Mar 24 '23 01:03

Jaydev