4

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?

Ahmet
  • 7,527
  • 3
  • 23
  • 47
AmandaKamphoff
  • 55
  • 1
  • 1
  • 7
  • Try `pip install opencv` in corresponding conda env – Sociopath Aug 10 '20 at 05:50
  • 4
    `conda install -c conda-forge opencv` – Nirmal Aug 10 '20 at 05:51
  • I tried `pip install opencv` and `conda install -c conda-forge opencv` and still failed with the same result @Sociopath and @nirmal – AmandaKamphoff Aug 10 '20 at 08:47
  • You need to be an administrator to install packages with your current setup. You should launch the Anaconda Prompt in Administrator mode. If you don't know how to do that, it would probably be best to uninstall and re-install Anaconda, clicking the box to install it only for your own user account. – darthbith Aug 10 '20 at 23:38

4 Answers4

10

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

conda install -c conda-forge opencv

Ransaka Ravihara
  • 1,786
  • 1
  • 13
  • 30
0

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
-1

Did you try:

pip install opencv-python

This one works on MacOS and Windows.

Adrien Kaczmarek
  • 530
  • 4
  • 13
-1

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.