Cannot Find Module Cv2 When Using Opencv

No module named 'cv2' but it is installed

1)Delete all your existing opencv installation

2) Reinstall it again in that way (python 3)

python -m pip install opencv-python

3) And Voila!

> import cv2
> sift = cv2.xfeatures2d.SIFT_create()

No module named 'cv2' issue with opencv and contrib modules

Did you try to restart your code editor? I often need to close the file or whole VScoode and reopen for it to see the library I just installed.

Another problem could be that you're installing cv2 to a python verse that youre not using on your code editor..
If youre using python2.9 on your code editor but you install cv2 on your terminal with "pip3.10 install opencv-python" command, your code editor wont find it

No module named 'cv2.cv2'

try this:

Create Virtual Environment

conda create --name opencv-env python=3.6

Activate the environment

activate opencv-env

Install OpenCV and other important packages

pip install numpy scipy matplotlib scikit-learn jupyter
pip install opencv-contrib-python
pip install dlib

Test your installation

import cv2
cv2.__version__


Related Topics



Leave a reply



Submit