0

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!

Shankar Pandey
  • 451
  • 1
  • 4
  • 22
  • Also, to verify the CV2 version.. i did a `cv2.__version__` in the python terminal and it gave `2.4` instead of the expected `3.0.0`. – Shankar Pandey Nov 04 '16 at 21:47

1 Answers1

0

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!

BelalC
  • 1
  • 1
  • Thanks. This did help - I am now able to install CV2 successfully BUT - opencv doesnt seem to reflect in my python for soem reason. I tried the following : `$ python import cv2 /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'import': [Errno 2] No such file or directory` – Shankar Pandey Nov 10 '16 at 08:15
  • that's strange! In any case - I found my install was being unstable and ended up installing OpenCV2 in a virtual envelope using Anaconda - the following tutorial worked great: – BelalC Dec 05 '16 at 04:07
  • https://rivercitylabs.org/up-and-running-with-opencv3-and-python-3-anaconda-edition/ (I know it's not a solution for actually compiling OpenCV but it saved me a lot of hassle! hopefully will try & compile from source when time allows) also - I meant you can install OpenCV3 with Python2/3 using the tutorial :) – BelalC Dec 05 '16 at 04:09