背景:工作需要在linux环境下安装dlib,conda安装完成后再pip里面找不到dlib,所以导包失败,因此尝试用dlib的源码安装
1、源码下载:
网址:https://pypi.org/simple/dlib/
我的是python3.6.6,试了不少次才发现19.15.0可以使用,python3.7可以用19.17.0
2、下载完成后解压,安装
python setup.py install
可能遇到的问题:
1、AttributeError: Module Pip has no attribute 'main'
原因:版本不对,比如我之前用19.8.1版本就不可以,具体原因没有深究
2、 Cannot find appropriate C compiler on this system.
解决:缺少gcc, suao apt install gcc
3、 Compile error: Cannot find a C++ compiler that supports both C++11 and the specified C++ flags
解决: sudo apt-get install g++
4、 Cannot find appropriate Makefile processor on this system
解决:缺少make, sudo apt install make
5、 CMake must be installed to build the following extensions: dlib
解决:缺少cmake 下载:https://cmake.org/download/ , 解压后:
./bootstrap make && make install