Skip to content

Instantly share code, notes, and snippets.

@ageitgey
Last active April 30, 2024 08:21
Show Gist options
  • Save ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf to your computer and use it in GitHub Desktop.
Save ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf to your computer and use it in GitHub Desktop.

How to install dlib v19.9 or newer (w/ python bindings) from github on macOS and Ubuntu

Pre-reqs:

  • Have Python 3 installed. On macOS, this could be installed from homebrew or even via standard Python 3.6 downloaded installer from https://www.python.org/download. On Linux, just use your package manager.
  • On macOS:
    • Install XCode from the Mac App Store (or install the XCode command line utils).
    • Have homebrew installed
  • On Linux:
    • For a full list of apt packages required, check out the example Dockerfile and copy what's installed there.
    • These instructions assume you are using Ubuntu 16.04 or newer. If you are using 14.04, you can try these installation instructions instead to work around the old CMake version.
  • These instructions assume you don't have an nVidia GPU and don't have Cuda and cuDNN installed and don't want GPU acceleration (since none of the current Mac models support this).

Clone the code from github:

git clone https://github.com/davisking/dlib.git

Build the main dlib library (optional if you just want to use Python):

cd dlib
mkdir build; cd build; cmake ..; cmake --build .

Build and install the Python extensions:

cd ..
python3 setup.py install

At this point, you should be able to run python3 and type import dlib successfully.

@liwg1995
Copy link

liwg1995 commented Dec 24, 2023 via email

@Cyb3r-0
Copy link

Cyb3r-0 commented Dec 25, 2023

好的。
一旦您得到我的问题相关模块的答案,请尽快回复我。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment