Import Error [closed]

asked 2018-05-01 05:31:23 -0600

Nimya gravatar image

updated 2018-05-01 09:11:28 -0600

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!

edit retag flag offensive reopen merge delete

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 ( 2018-05-01 05:36:38 -0600 )edit

I have Installed OpenCV in mac using Homebrew

Nimya gravatar imageNimya ( 2018-05-01 08:59:43 -0600 )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 ( 2018-05-01 09:52:49 -0600 )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 ( 2018-05-01 10:05:41 -0600 )edit

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

berak gravatar imageberak ( 2018-05-01 10:07:25 -0600 )edit

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

Nimya gravatar imageNimya ( 2018-05-01 11:21:09 -0600 )edit

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

berak gravatar imageberak ( 2018-05-01 11:25:01 -0600 )edit

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

berak gravatar imageberak ( 2018-05-01 11:26:06 -0600 )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 ( 2018-05-01 11:29:44 -0600 )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 ( 2018-05-01 11:31:54 -0600 )edit