Ask Your Question

install opencv python27 Mac question

asked 2013-03-28 03:28:55 -0600

johnsankey gravatar image

updated 2013-03-28 20:02:10 -0600

I have Python 2.7 installed in /Library/Frameworks/Python-framework... along with numpy and scipy; Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin; Mac OS 10.6.8 on standard desktop iMac

How can I install opencv linked to _this_ python?

(I've also get a macports python in /opt/local/Library... that was supposed to work with macports opencv; it doesn't because it's getting mixed up with the Apple python, so I hope to be able to remove it without fouling up even more things. Suggestions welcome on this too.)

I should also note that there are dozens of people trying to take a course at Coursera who have a similar problem trying to get Opencv to work on a Mac. We all hope someone expert in Opencv can help.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-03-29 14:43:50 -0600

kieagu gravatar image

I'm not sure if opencv's installation is specific to a version of python, but you can always change which version of python is active like this:

sudo port select --set python python27

That will set your active python version to 2.7.

edit flag offensive delete link more


Correct, it does, but it sets it to Apple's Python, not to the MacPorts Python that has OpenCV attached to it.

johnsankey gravatar imagejohnsankey ( 2013-04-02 17:53:21 -0600 )edit

answered 2013-03-29 15:19:17 -0600

AlexanderShishkov gravatar image

The simplest way that I know contains two steps:

  1. brew install opencv
  2. export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"

Detailed description of brew installation is here.

edit flag offensive delete link more


This doesn't work for the same reason that MacPorts install of OpenCV doesn't work: changing PYTHONPATH prevents QGIS from working. I need to link OpenCV to Apple's Python. Besides it requires the homebrew Python to be installed, making a third copy of python :-(

johnsankey gravatar imagejohnsankey ( 2013-04-02 17:51:39 -0600 )edit

Question Tools


Asked: 2013-03-28 03:28:55 -0600

Seen: 668 times

Last updated: Mar 29 '13