Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

by seeing the port select, it is clear that python27 is not selected. So first do the following:

sudo port select --set python python27

Then open your .bash_profile with

open -t ~/.bash_profile

and add the following line:

export PYTHONPATH=<path where cv2.so is located>:$PYTHONPATH

This path can vary. in my case it was located in

/opt/local/Library/Frameworks/Python.framework/versions/2.7/lib/Python2.7/site-packages

Once you save the bash_profile close your terminal and open it again.

Then try python and the import cv2 line and voila!