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?
Chetan Shidling Staff asked 4 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
Chetan Shidling Staff answered 4 years ago

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