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 https://pypi.org/project/opencv-python/ 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 http://blog.taesoo.org/?p=210 and http://opencv.willowgarage.com/documentation/python/introduction.html.
-
1First of all, you don't need to be in any particular folder to import the cv package. Second of all, the OP was asking for Python 3 instructions, and you are talking about Python 2.6. There is a world of difference there.– GaRyuJul 19, 2012 at 10:54
-
1