Skip to content

OpenCV Module Not Found

brycearden edited this page Apr 4, 2016 · 2 revisions

import cv2 module not found

There is a common bug found with the installation script. If you open up a python shell and run the following command. It is related to the fact that OpenCV wants to take over your computer, and we want OpenCV to run from inside a virtual environment so that we have better dependency management for this project.

import cv2

And you get an error about how the cv2 module is not found, then perform the following actions:

  1. Check the src/venv/lib/python2.7/site-packages directory to make sure that the cv.so binary is installed. If it is not there then copy it from the location mentioned in step 2.
  2. If the binary is installed on your virtual environment, then go to /usr/local/lib/python2.7/site-packages to make sure that the cv2.so binary is also located there.
  3. If the binary is not there, then something was wrong with the installation and you need to rerun ./install.sh from the opencv directory
  4. Copy the cv2.so binary into the /usr/local/lib/python2.7/dist-packages directory.
  5. Reopen up your virtualenv again and run
import cv2
  1. At this point you should not receive any errors.
Clone this wiki locally