Python package OpenCV installation issue on mac Sierra

518 Views Asked by At

I am facing issues while installing OpenCV package on Mac Sierra (10.12.1)

I followed all the steps mentioned in the link :

http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/

I got issues related to QTKit.h file not being present. This is a known issue and so I followed several solutions but none worked. I then followed all possible solutions present here :

https://github.com/opencv/opencv/issues/6913

&

http://stackoverflow.com/questions/39590741/fatal-error-qtkit-qtkit-h-file-not-found-when-i-build-opencv-on-mac

But none of them seem to work (or so I guess) I cannot see the location where OpenCV has been installed.

I did try to check in the TERMINAL by doing an import and it works without issues.

IMPORT CV2

But when I run my code on the python IDE (PyCharm), I get the error for CV2 module not found.

I also tried searching in Pycharm's IDE if I could see a CV2, but i couldn't.

Please help!

1

There are 1 best solutions below

3
BelalC On

I ran into the same issues installing OpenCV with Python 2.7 following Adrian's tutorial on pyimage. I got around the issue with compiling on macOS Sierra by switching to the ‘pr7266’ branch for opencv and switching to the ‘master’ branch for opencv_contrib

$ git clone https://github.com/Itseez/opencv.git
$ cd opencv
$ git fetch https://github.com/opencv/opencv.git +pull/7266/head:pr7266
$ git checkout pr7266 # instead of 3.0.0 or 3.1.0

See instructions at - https://github.com/opencv/opencv/pull/7266

I've never used PyCharm before so can't help there, hope this helps though!