How do I import OpenCV library into python 3.1?

OpenCV 2.1 was first installed when I had the original python 2.6 and this works fine. However after getting the Python 3.1, it has no module called 'cv' after trying to import OpenCV. How to add these modules?

3 Answers

According to this answer on StackOverflow, OpenCV doesn't support Python 3 and no one is working on Python 3 support either.

1

As of April 2019, you can install opencv for Python 2.7 and 3.4-3.7. It can be installed via pip for PythonV2 and pip3 for PythonV3:

pip3 install opencv-python
  • In case of installation problems you may need to upgrade your pip version (pip install --upgrade pip)
  • Despite the package name the module is still imported in Python using:

    import cv2

See for details.

Simply use import statement. First go to

$ cd /usr/local/lib/python2.6/site-packages/opencv

Then start python:

$ python
>>> import cv.py

For any other help, refer and .

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like