0

I'm following the instructions on this page: http://www.learnopencv.com/facial-landmark-detection/

1.Download a copy from github

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

Build examples ( OSX / Linux )

cd dlib/examples

mkdir build

cd build

cmake ..

cmake --build . --config Release

Compile dlib python module

cd dlib/python_examples

./compile_dlib_python_module.bat

P.S. on this step, i didn't find that file in my python_examples folder so I googled and downloaded one and used it.

export PYTHONPATH=/path/to/dlib/python_examples:$PYTHONPATH

Next, I went to terminal and added that line to the bottom my my .bash_profile file.

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
export PYTHONPATH=/Users/leoli/dlib/python_examples:$PYTHONPATH

At last, I typed `python -c "import dlib" in terminal but received this error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(./dlib.so, 2): Library not loaded: libboost_python.dylib
  Referenced from: /Users/leoli/dlib/python_examples/dlib.so
  Reason: unsafe use of relative rpath libboost_python.dylib in ./dlib.so with restricted binary

I am using OSX 10.11.5

Community
  • 1
  • 1
Pirlo Lochisomo
  • 185
  • 1
  • 16

1 Answers1

1

For using dlib with python, follow instructions in readme.txt:

COMPILING DLIB Python API
Before you can run the Python example programs you must compile dlib.
Type:
python setup.py install or type
python setup.py install --yes USE_AVX_INSTRUCTIONS
if you have a CPU that supports AVX instructions, since this makes some things run faster.

And may be you will need some dependencies:

sudo apt-get install libboost-python-dev cmake
Evgeniy
  • 2,481
  • 14
  • 24