ImportError: No module named 'cv2' using jupyter

I am trying to import OpenCV into my ipynb using Jupyter. I kept getting:

ImportError: no module named 'cv2'

import cv2 import pandas as pd import numpy as np import matplotlib from matplotlib import pyplot as plt import seaborn as sns 

Any idea to import cv2 into jupyter?

+6
source share
2 answers

If you have already installed opencv, then it is possible that your laptop and your opencv library are in 2 different python environments. The following has helped me in the past:

  1. Open laptop
  2. In the new cell type:

!pip install opencv-python

Please note that something ! intentionally. This will install open-cv in your current laptop environment.

+2
source

You can print

 which jupyter-notebook 

if it is not installed in opencv-python envs, you should install jupyter in envs:

 condda install jupyter-notebook 
0
source

Source: https://habr.com/ru/post/1232250/


All Articles