Home > Back-end >  import cv2 >> ModuleNotFoundError: No module named 'cv2'
import cv2 >> ModuleNotFoundError: No module named 'cv2'

Time:10-30

    import cv2

ModuleNotFoundError: No module named 'cv2'
although it already installed but run in cmd only 
not working in any IDE like Vs or spyder or Jupyter 

i wanna to make IDE import OpenCv

CodePudding user response:

try:
   import cv2
except:
    subprocess.check_call([sys.executable, "-m", "pip", "install", 'cv2'])

Alternatively, open a console in your IDE and execute the following:

pip install cv2

Your IDE probably uses a different python instance to the one your console uses

  • Related