Note: If Caffe has been installed on the machine, we just need to copy the cv2.so from '/usr/lib/python2.7/dist-packages' to '/usr/local/lib/python2.7/site-packages'.
When you install on MAC by command line,
1. You may be stuck at the permission denied problem, try sudo.
2. I still can't import cv after I successfully installed the OpenCV using brew. I got the solution as following:
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
mkdir -p /Users/sunformoon/.local/lib/python2.7/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/sunformoon/.local/lib/python2.7/site-packages/homebrew.pth
3. If the build is successful, but you cannot still import cv2 from a Python after running make install, you can manually cp the cv2.so file from the '/build/lib' to '/usr/local/lib/python2.7/dist-packages'.