13

I am trying to import cv2 module in PyCharm, but it shows error. I tried in terminal as well

pip install opencv-python
pip3 install cv2
pip install opencv-python
pip3 install cv2

and whatnot.

Trying to install opencv-python from terminal shows this

Requirement already satisfied: opencv-python in ./anaconda3/lib/python3.6/site-packages (3.4.1.15)

and trying to install cv2 from terminal shows this

Could not find a version that satisfies the requirement cv2 (from versions: )
No matching distribution found for cv2

However, trying to import cv2 on Pycharm shows this :

Pycharm Error Image

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
thesamiroli
  • 420
  • 3
  • 8
  • 21

4 Answers4

25

First, install the package named opencv-python via pip install opencv-python or use the GUI.

Second, just input import cv2; that is ok.

zero2cx
  • 482
  • 6
  • 19
Jing
  • 402
  • 5
  • 4
10

Go to File->Settings->Project Interpreter and then add by '+' button 'opencv-python' module on this repository.

It downloaded without an error for my PyCharm and also downloaded the dependencies as well.

methamphetamine
  • 148
  • 1
  • 5
  • For those having similar issues as the OP and have already tried the `pip install opencv-python` without success, this may be your correct answer. Go to the Interpreter, press the "+" button, search for "opencv-python", click "Install Package." After that, `import cv2` should work – Sludge Jan 19 '20 at 12:50
0

While creating a new project in PyCharm, please select 'Base Interpreter' option from drop-down similar to the one shown in this link: Creating new Project stage

Next, after successful creation of project and after downloading the opencv-python, it looks a shown in this link: Success message

0

In my case, I tired several solutions from internet.No luck. But below approach worked fine with me.

In the pycharm interpreter settings, I installed pip & opencv-python. This worked.

deepu
  • 147
  • 2
  • 12