Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm does not recognize cv2 as a module

Tags:

I am using OpenCV 3 and python 2.7 and coding using PyCharm. The code works fine but PyCharm does not recognize cv2 as a module. It underlines it with a red line, so it doesn't display its functions in the intellisence menu.

I tried to set an environment variable OPENCV_DIR but it didn't work

OpenCV is extracted in F:\opencv and Python is installed on C:\Python27

What is wrong ?

like image 389
Abd ElRahman Abbas Avatar asked Dec 18 '15 22:12

Abd ElRahman Abbas


1 Answers

here are proper instructions if you have not built opencv from source so that everyone can follow it

  • Click File menu > Settings

enter image description here

  • Search " Project Interpreter " in search bar

enter image description here

  • Click that + button to install packages or press Alt+Insert enter image description here

  • now Available packages window will open and then search for " opencv-python " and click install package button.

enter image description here

  • enjoy and do +1
like image 109
user889030 Avatar answered Sep 20 '22 07:09

user889030