Python2 (opencv2) with Homebrew

Python 2

  • brew install python
  • brew install opencv
  • python
>>> import cv2

Python3 (opencv3) with Homebrew and PIP

Python3

  • brew install python3
  • brew uninstall opencv3
  • brew install opencv3 --without-python --with-python3
  • echo /usr/local/opt/opencv3/lib/python3.6/site-packages >> /usr/local/lib/python3.6/site-packages/opencv3.pth
  • python3
>>> import cv2

Refer to this

Install dlib (only for Python3)

dlib is very useful for face detection machine learning, but it is hard to install on mac osx with python. compile issue and compile issue2

I got some script from this, but still not working for me.

Using PIP3 to install dlib for python3

  • Install boost for python3 but not for python2
    • brew install boost-python --with-python3 --without-python
  • pip3 install dlib
  • python3
>>> import dlib

Reference


Buy Me A Coffee

Evan

Attitude is everything