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.
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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.