No module named 'cv2' on Anaconda 3.8.3

Viewed 13461

I just Installed the latest Anaconda 3.8.3 with conda version 4.8.3 right away after I installed Anaconda, I use Jupyter Notebook then type

import cv2

it says

ModuleNotFoundError Traceback (most recent call last) in ----> 1 import cv2

ModuleNotFoundError: No module named 'cv2'

then based on : Cannot find module cv2 when using OpenCV

someone suggested trying

conda install -c https://conda.binstar.org/menpo opencv

from the Anaconda Prompt

prompt result

Is there any other way to install cv2?

4 Answers

Just open your command prompt with run as administrator. And try,

conda install -c conda-forge opencv

I was getting this error when using the command conda install -c menpo opencv

Specifications:

  • opencv -> python[version='2.7.*|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0'] Your python: python=3.8 .So,by using pip it got solved.
pip install opencv-contrib-python

Did you try:

pip install opencv-python

This one works on MacOS and Windows.

If I understand you correctly, you may be able to solve the problem with this command.

 pip install opencv-python

If not, I think maybe the virtual environment is set up incorrectly. Make sure the package is installed on the appropriate interpreter.

Related