Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

First of all: I don't use Mac but Linux (and partially Windows), so maybe it is different. But here is how it works under Linux and since MacOs and Linux are similar in many points (since MacOs is an early FreeBSD clone) it may also work for you (no guarantee here!). Ah and before you start now following my points: Have you checked if python is properly installed at all? Try to run ipython (the interactive python shall). If that is not the case install python first properly! Okay now my linux-opencv-install-howto ;) :

  1. Extract opencv-package in a folder - lets call it 'opencv'
  2. make a build folder in the extracted folder, let's call it 'build'
  3. go into that folder ( cd build)
  4. start ccmake by ccmake ../ , now you get a curse-interface, select the option to build Python (I think it's called build_opencv_python - or similar - I am currently not under linix...). If you have set your options (you can also select several others like optimization stuff and so on): hit c for configure, hit c probably again, until it disappears (if you get any errors you have to resolve them now), hit g for generate and quit.
  5. run make -j3 (that calls the make-files with 3 threads to build opencv a little bit faster ;)
  6. run sudo make install (this installs opencv to the cmake-install-prefix-path, typically /usr/local (maybe this is different under MacOS)

If you have installed Python properly beforehand everything should work fine now. If it doesn't work then try to set your PYTHONPATH (this is an environment variable) to the location where cv2.so is located. Look it up online how to set environment variables under MacOS (under linux it works by putting it in the .bashrc file like this: export PYTHONPATH=$PYTHONPATH:/your/path/to/python/stuff). Good luck!