Install dlib with pyenv

There are so many guides to install dlib on Mac.

But, I had a hard time for that. Like below.

[ 98%] Building CXX object CMakeFiles/dlib_.dir/src/face_recognition.cpp.o
[ 99%] Building CXX object CMakeFiles/dlib_.dir/src/gui.cpp.o
make[2]: *** No rule to make target `/Users/user_name/.pyenv/versions/2.7.10/lib/libpython2.7.dylib’, needed by `’. Stop.
error: cmake build failed!

Actually, what the error said is pretty clear. However, unfortunately, I could not find out the way to solve this problem in English website.

Then, I tried to research in Japanese(because Japanese is my native). Finally, I found out the solution.

First, what I did was to uninstall python 2.7.10 by pyenv

pyenv uninstall 2.7.10env PYTHON_CONFIGURE_OPTS=” — enable-framework” pyenv install 2.7.10

This command can generate dylib which we need to install dlib.

If you want to install dlib with another python version, what you need to is to change the python version like below.

env PYTHON_CONFIGURE_OPTS=” — enable-framework” pyenv install 3.5.0

Let’s install dlib with pip

pip install dlib
Collecting dlib
Using cached dlib-19.4.0.tar.gz
Installing collected packages: dlib
Running install for dlib ... done
Successfully installed dlib-19.4.0

Written by

#CreativeCoding #Art #PhysicalComputing #IoT #MachineLearning #python #creativetech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store