ImportError: No module named cv2 in caffe installed in ubuntu16.04

Issue

I installed caffe from this site on Ubuntu 16.04, python 2.7 is default and there is python 3.5.2 on system,too.
I installed apollocaffe,too.
When I was trying to run my code, an error occured:

ImportError: No module named cv2

I did execute this code :sudo apt-get install -y libopencv-dev as in installation guide is said.

and in Makefile.config I uncommented the line about "python3".
I viewed the "dist-packages" in python3.5 and it is empty.
what should I do???
I appreciate any help.

Solution

I found a workaround for my case:

pip install opencv-python

and now

import cv2

works.

Answered By – Samaneh Rezaei

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published