close

[Solved] ” No module named ‘cv2’ ” but it is installed

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ” No module named ‘cv2’ ” but it is installed in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ” No module named ‘cv2’ ” but it is installed Error Occurs?

Today I get the following error ” No module named ‘cv2’ ” but it is installed in python.

How To Solve ” No module named ‘cv2’ ” but it is installed Error ?

  1. How To Solve ” No module named 'cv2' ” but it is installed Error ?

    To Solve ” No module named 'cv2' ” but it is installed Error

  2. vi /etc/profile edit the profile and add export PYTHONPATH=/usr/local/lib/python3.6/site-packages:$PYTHONPATH to the last line.
  3. ” No module named 'cv2' ” but it is installed

    To Solve ” No module named 'cv2' ” but it is installed Error

  4. vi /etc/profile edit the profile and add export PYTHONPATH=/usr/local/lib/python3.6/site-packages:$PYTHONPATH to the last line.

Solution 1

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()

Solution 2

There is 2 possible problems about ModuleNotFoundError: No module named ‘cv2’.

  1. find the cv2.so file and move it into usr/local/lib/python3.6/site-packagesfind / -name 'cv2.so' possible output /usr/local/lib/python3.6/site-packages/cd /usr/local/lib/python3.6/site-packages/cp cv2.so /usr/lib/python3.6/site-packages/then quit the terminal and rerun it.
  2. vi /etc/profile edit the profile and add export PYTHONPATH=/usr/local/lib/python3.6/site-packages:$PYTHONPATH to the last line.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read