最近更新于 2022-05-25 18:56

验证设备: Ubuntu 20.04

1.依赖安装

sudo apt install -y build-essential cmake git libx11-dev libopenblas-dev liblapack-dev pkg-config

如果需要 GPU 加速支持,可以先配置 GPU 环境(https://blog.iyatt.com/?p=2224),构建时检测到 CUDA 就会添加支持。

2.获取源码 (当前 2021-7-19 最新版本为 v19.22 ,可指定版本获取)

dlib项目地址

git clone https://github.com/davisking/dlib.git --branch v19.22 --depth=1

3.构建安装

cd dlib && mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
# C
sudo make install -j$(nproc)

# Python
python3 -m pip install ..

4.配置库搜索路径

sudo -s
echo "/usr/local/lib" > /etc/ld.so.conf.d/dlib-1.conf
ldconfig
echo "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" >> /etc/bash.bashrc
source /etc/bash.bashrc
exit

验证安装

作者 IYATT-yx