Reputation: 7
so, i was trying to import cv2 to my jupyter notebook.
but it said
ModuleNotFoundError
Traceback (most recent call last)
in
----> 1 import cv2
ModuleNotFoundError: No module named 'cv2'
i already installed it using the command : pip install opencv-python I'm on MacOS Catalina, please help me.
Upvotes: 0
Views: 3278
Reputation: 187
I faced similar problem when installing opencv using conda and troubleshooted this by adding kernel manually as described in this page https://www.programmersought.com/article/97466914065/
The following are adaptations from the above-mentioned page:
conda install ipykernel
python -m ipykernel install --name stm32 --display-name "stm32h7"
Now, install cv2 again and inside the Jupyter Notebook, activate the stm32h7
kernel by clicking on Kernel --> Change Kernel --> stm32h7
. Now, try to import cv2
again.
Upvotes: 0
Reputation: 31
Do you have more than one python version installed? If so, make sure you are using the python interpreter you think you use for your notebook. Run
!pip freeze
in your notebook to check if opencv-python is really listed as an installed package. if not install it for that version or
Change Interpreter in Jupyter notebook
Upvotes: 0