MacOS环境下安装dlib

这个过程中遇到了不少问题我将其记录
首先是目的,为了使用人脸识别的框架,我需要安装dlib
想到的方法如下

pip install dilb

后使用清华换源

pip install dlib -i https://pypi.tuna.tsinghua.edu.cn/simple

报错很长看不懂

ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-f9m_7om0/dlib/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-f9m_7om0/dlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-tvwmcads/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/dlib
         cwd: /private/tmp/pip-install-f9m_7om0/dlib/
    Complete output (55 lines):
    running install
    running build
    running build_py
    package init file 'dlib/__init__.py' not found (or not a regular file)
    running build_ext

根据对错误的解读我查找了一些资料,大部分没什么用,有很多甚至装许多莫名其妙的包

只需要预先安装两个包就行,分别是CMake,Boost

依然是换源,快一些总是好的哈

pip install CMake -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install Boost -i https://pypi.tuna.tsinghua.edu.cn/simple

再安装dlib就行了

pip install dlib -i https://pypi.tuna.tsinghua.edu.cn/simple

成功即可

——————————————————————————————
补充一下换源一些国内源
清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:http://pypi.hustunique.com/

山东理工大学:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

你可能感兴趣的:(dlib)