Importerror: the perfect solution of no module named CV2!!! (not too good)

: on January 21, 2018, at 10:13 PM, I excitedly uploaded my CSDN blog from the Ubuntu system and sent an congratulatory message. I congratulated myself on solving the problem of ImportError: No module named cv2. It is like a phone call from another world (Ubuntu world) to the real world (Windows world).

it started a long time ago at 4:30 PM, when I was just a kid, a naive kid, getting ready to run a fast r-cnn demo on my Ubuntu system. Of course, the purpose is to test my caffe environment. This demo is the training model on Github, I won’t go into details, you can refer to this blogger’s tutorial, which is simple and clear. I won’t say.

my setup environment is

ubuntu14.04

caffe

opencv 3.0.0 – beta

anaconda2

but when you run the last step

./demo.py --cpu

suddenly appeared an error, the initial error can not find easydict module (
ImportError: No module named easydict

sudo pip install easydict

easydict installation, but still prompt can not find, actually this sentence after running if successful installation should be in your/usr/local/lib/python2.7 dist – packages folder has a easydict folder, but this time when wrong, because you try to run again./demo. Py – CPU, still can appear the error, That’s because easydict should be on your home/anaconda2/lib/python2.7/site – under the packages folder, why, that’s because the configuration of the environment on with me, because my python with the anaconda and not the python, so be it.

ImportError: No module named cv2

and then the main thing, which is that cv2 can’t be found, and I’m going to just say the solution here, just to give you a sense of perspective, is that when I come across this problem, I go from being a kid, a naive kid, to being a car brother.

step 1:

install python – opencv

sudo apt-get install python-opencv

See if it’s resolved. If it’s not resolved, look at step 2.

step 2:

find cv2. So copying files to your/usr/local/lib/python2.7 site – packages folder (in the case of no use you anaconda), how to find your cv2. So, I offer a very convenient method (must use this method, or you not seek) :

find/-name "cv2.so"

and then on the terminal CD to home, type python, python version number and so on, and then

>>>import cv2

If there is no error, the problem is solved.

in the absence of anaconda, by this point it should have been completely resolved, and if you haven’t resolved it yet, look at step 3:

step 3:

see the third step that USES the anaconda, find cv2 through the second step. So, reproduction cv2. So to home/anaconda2/lib/python2.7/site – packages folder, and then the second step, input the python, then input the import cv2. Just fine.

thank you! My show is over! Please enjoy the picture:

Read More: