Import Error [closed]

asked May 1 '18

Nimya gravatar image

updated May 1 '18

berak gravatar image

Traceback (most recent call last):

File "<pyshell#0>", line 1, in <module> import cv2

ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so, 2): Library not loaded: /usr/local/opt/tesseract/lib/libtesseract.3.dylib Referenced from: /usr/local/Cellar/opencv/3.4.1_3/lib/libopencv_text.3.4.dylib Reason: image not found

Can anyone Help me in solving this

I am using MacOS High Seirra and installed Opencv using Homebrew.

Thank You!

Preview: (hide)

Closed for the following reason the question is answered, right answer was accepted by Nimya
close date 2018-05-10 10:03:31.497064

Comments

your cv2 was built with tesseract support, but you don't seem to have that.

how did you install this ?

berak gravatar imageberak (May 1 '18)edit

I have Installed OpenCV in mac using Homebrew

Nimya gravatar imageNimya (May 1 '18)edit

I have solved the import error by reinstalling OpenCV -with contrib. But now the problem is cv2.imread() always returns None and if i check python version in terminal its shows Python 2.7.14 but i have python 3.6.5 installed.

Please help me in switching to new python version and to resolve imread() error ??

Nimya gravatar imageNimya (May 1 '18)edit

idk, why it is so, but python folks generally don't seem to get "murphy's law".

if there is a path involved, to read an image, it might be the wrong one.

berak gravatar imageberak (May 1 '18)edit

but again, since it's unrelated to your previous question, please start a new one, include details, etc.

berak gravatar imageberak (May 1 '18)edit

Image path is correct only but still its not reading image why it is so ??

Nimya gravatar imageNimya (May 1 '18)edit

what is your img ? (like .gif not supported)

berak gravatar imageberak (May 1 '18)edit

"Image path is correct" -- well god knows, we don't.

berak gravatar imageberak (May 1 '18)edit

what python user usually get wrong with relative path is: it does not matter, where your script is -- it does matter, from where you start it (might be 2 entirely different pair of boots)

berak gravatar imageberak (May 1 '18)edit

if i check python version in terminal its shows Python 2.7.14 but i have python 3.6.5 installed. How can i solve this ???

Nimya gravatar imageNimya (May 1 '18)edit