python 3.x – How to import cv2 in python3?

python 3.x – How to import cv2 in python3?

Your screenshot shows you doing a pip install from the python terminal which is wrong. Do that outside the python terminal. Also the package I believe you want is:

pip install opencv-python

Since youre running on Windows, I might look at the official install manual: https://breakthrough.github.io/Installing-OpenCV

opencv2 is ONLY compatible with Python3 if you do so by compiling the source code. See the section under opencv supported python versions: https://pypi.org/project/opencv-python

Make a virtual enviroment using python3

virtualenv env_name --python=python3

and run the following command

pip3 install opencv-python

python 3.x – How to import cv2 in python3?

There is a problem with pylint, which I do not completely understood yet.

You can just import OpenCV with:
from cv2 import cv2

enter

Leave a Reply

Your email address will not be published. Required fields are marked *