Install dlib for MacOS

Step #1: Install dlib prerequisites

The dlib library only has four primary prerequisites:

  • BoostBoost is a collection of peer-reviewed (i.e., very high quality) C++ libraries that help programmers not get caught up in reinventing the wheel. Boost provides implementations for linear algebra, multithreading, basic image processing, and unit testing, just to name a few.
  • Boost.Python: As the name of this library suggests, Boost.Python provides interoperability between the C++ and Python programming language.
  • CMake: CMake is an open-source, cross-platform set of tools used to build, test, and package software. You might already be familiar with CMake if you have used it to compile OpenCV on your system.
  • X11/XQuartx: Short for “X Window System”, X11 provides a basic framework for GUI development, common on Unix-like operating systems. The macOS/OSX version of X11 is called XQuartz.

In order to install Boost, Boost.Python, and CMake on macOS, you’ll be using the Homebrew package manager.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update

Install python2.7 & python3.6 

$ brew install python
$ brew install python3

Install CMake, Boost & Boost-Python 

$ brew install cmake
$ brew install boost
$ brew install boost-python --with-python3

Check the Install Result 

$ brew list | grep 'boost'
boost
boost-python

Step #2: Install dlib with Python bindings

Numpy, Scipy & scikit-image  for image processing or computer vision 

$ pip install numpy
$ pip install scipy
$ pip install scikit-image

Use pip install dlib 

$ pip install dlib

You should see that dlib has been successfully installed.

猜你喜欢

转载自my.oschina.net/u/2272631/blog/1623028