how to change opencv library path How to change path of opencv library. I have installed opencv using homebrew.

But when I run some opencv code it tries to link opencv library with my older version of opencv (in error below path is /Users/Ashok/Downloads/opencv-2.4.6.1), but I have deleted this folder and reinstalled opencv using homebew.

Ashok$ python face_detection.py 
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /Users/Ashok/Downloads/opencv-2.4.6.1/modules/imgproc/src/color.cpp, line 3402
Traceback (most recent call last):
  File "face_detection.py", line 8, in &lt;module&gt;
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: /Users/Ashok/Downloads/opencv-2.4.6.1/modules/imgproc/src/color.cpp:3402: error: (-215) scn == 3 || scn == 4 in function cvtColor
Have you "installed" python via homebrew. This doesn't actually install python but sets up a number of things so the built in python plays nicely with homebrew.

sudo brew install python


This fixed a couple of these sort of problems for me when getting iPython working.