CS Electrical And Electronics
@cselectricalandelectronics

ModuleNotFoundError: No module named 'cv2' and ameError: name 'cv2' is not defined

All QuestionsCategory: Artificial Intelligence, Machine Learning, & Deep LearningModuleNotFoundError: No module named 'cv2' and ameError: name 'cv2' is not defined
CS Electrical And Electronics Staff asked 3 years ago

How to fix this error, I need help?
 

mport numpy as np
import matplotlib
import cv2
from matplotlib import pyplot as plt
%matplotlib inline

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-f0bf904db36f> in <module>
      1 import numpy as np
      2 import matplotlib
----> 3 import cv2
      4 from matplotlib import pyplot as plt
      5 get_ipython().run_line_magic('matplotlib', 'inline')

ModuleNotFoundError: No module named 'cv2'

img = cv2.imread('./test_images/sharepova1.jpg')
img.shape

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-7-6a7b785bbc8e> in <module>
----> 1 img = cv2.imread('./test_images/sharepova1.jpg')
      2 img.shape

NameError: name 'cv2' is not defined