CS Electrical And Electronics
@cselectricalandelectronics

ModuleNotFoundError: No module named 'cv2' in jupyter, how to fix it?

All QuestionsCategory: Artificial Intelligence, Machine Learning, & Deep LearningModuleNotFoundError: No module named 'cv2' in jupyter, how to fix it?
CS Electrical And Electronics Staff asked 3 years ago

Here is the code:
 

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


---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-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'
1 Answers
CS Electrical And Electronics Staff answered 3 years ago

First, insert one cell above and then type:
 
!pip install opencv-python
 
It will work.