解决windows10下安装dlib与face-recognition的问题

以后博客更新内容都会在oldpan.me
github中相关问题解决方法:https://github.com/ageitgey/face_recognition/issues/175#issue-257710508
对于安装face-recognition在window的方法,在dlib的github中的issue中已经有人进行了回答,但是回答者较为复杂,且有些步骤可以简化一下。

问题原因

安装face-recognition需要首先安装dlib
windows无法直接安装dlib的原因主要是因为缺少相应的编译环境,只要安装好相应的编译环境即可。

相关软件

1、VS 2015 C++相关组件,注意,需要的是2015而不是2017,VS2017的相关组件对C++编译的支持并不好,因此必须下载安装好VS2015的C++相关组件。
注意:VS 2015 安装器默认不安装C++相关组件,需要自己选择添加安装!!
2、Boost C++ Libraries,下载好Third Party Downloads-Windows Binaries中的boost_1_66_0-msvc-14.0-64.exe,点击exe安装到C盘,到期安装目录,点击b2进行编译,编译好的文件放到了stage中。
3、安装cmake,百度直接安装即可,cmake在安装过程中切记选择添加路径到环境变量中。

问题解决

安装好上面说的三个部件后,直接运行pip install face-recognition即可,会将dlib一并安装。
出现以下信息说明安装成功。

C:\Users\dell\PycharmProjects\Pytorch-Learn>C:\Users\dell\Anaconda3\envs\my-pytorch\Scripts\pip install face-recognition
Collecting face-recognition
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/fa/2d/dbb78acb411de238869451afae8387ae8200d3fe0672f6817a918e03ca49/face_recognition-1.0.0-py2.py3-none-any.whl
Requirement already satisfied: Pillow in c:\users\dell\anaconda3\envs\my-pytorch\lib\site-packages (from face-recognition)
Requirement already satisfied: numpy in c:\users\dell\anaconda3\envs\my-pytorch\lib\site-packages (from face-recognition)
Requirement already satisfied: face-recognition-models>=0.2.0 in c:\users\dell\anaconda3\envs\my-pytorch\lib\site-packages (from face-recognition)
Requirement already satisfied: scipy>=0.17.0 in c:\users\dell\anaconda3\envs\my-pytorch\lib\site-packages (from face-recognition)
Collecting dlib>=19.5 (from face-recognition)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/23/7a/891d4c46cdf755fb69eec0f06a53033d3754bf68ace5342ad56aeb540aa1/dlib-19.9.0.tar.gz
Requirement already satisfied: Click>=6.0 in c:\users\dell\anaconda3\envs\my-pytorch\lib\site-packages (from face-recognition)
Requirement already satisfied: olefile in c:\users\dell\anaconda3\envs\my-pytorch\lib\site-packages (from Pillow->face-recognition)
Building wheels for collected packages: dlib
  Running setup.py bdist_wheel for dlib ... done
  Stored in directory: C:\Users\dell\AppData\Local\pip\Cache\wheels\5d\94\db\0ddfd06142fc4ee80b89d1e6cd158185a9bf40d93b8d92e2ee
Successfully built dlib
Installing collected packages: dlib, face-recognition
Successfully installed dlib-19.9.0 face-recognition-1.0.0
上一篇:Java开发之路


下一篇:SAP S/4HANA系统上所有可以用来创建扩展字段的业务上下文