利用Python实现人脸识别:face_recognition的安装

How to install python face_recognition

Face_recognition是利用Python实现人脸识别时非常重要的一个package,可以以非常少的代码行数实现强大的功能,但其在Windows系统下的安装过程是较为复杂的,本人也参考了一些视频及网页但都没有一个完整可行的安装方案,于是在安装过程中,整理了一下安装流程,适合刚下完python跃跃欲试的小白看。
由于是站在了前人的肩膀上,基本属于搬运整合,所以每一步都附上了原链接,可以先看看原链接。
当然首先,你要先确保你的电脑上安装了Python以及Visual Studio。

Python官网

Python官网中给出了下载安装packages时的注意事项
参考 https://packaging.python.org/tutorials/installing-packages/

  1. Ensure you can run Python from the command line
    控制面板(win10可能不会显示在桌面上,可通过搜索cmd找到它)中输入:
    python --version
    出现你python的版本;
  2. Ensure you can run pip from the command line
    控制面板中输入:pip --version
    出现你pip的版本//pip:一个python包管理工具;
  3. Ensure pip, setuptools, and wheel are up to date
    //pip的更新
    控制面板中输入:
    python -m pip install --upgrade pip setuptools wheel

安装 face_recognition

参考 https://my.oschina.net/u/2428854/blog/1797473
这个网站上讲的还是很详细的。

  1. 安装 face_recognition
    控制面板中输入:pip install face_recognition
    //可能需要耗费一定时间
    //会出现报错(不用管它)
  2. 安装boost
    下载地址:https://www.boost.org/users/download/
    选择其中最后一个.zip文件
    下载
    解压
    进入控制面板:
    输入cd boost的解压目录
    例如:
    C:\Users\zz>cd C:\Users\zz\s\boost_1_70_0 回车
    C:\Users\zz\s\boost_1_70_0>bootstrap.bat
    //可能需要耗费一定时间
  3. 安装cmake
    下载地址:https://cmake.org/download/
    选这个Windows win64-x64 Installer: Installer tool has changed. Uninstall CMake 3.4 or lower first!
    进入安装界面后选择Add CMake to the system PATH for all users
  4. 将CMake添加到路径
    //虽然上一步已经选过了不过这里还是再做一下否则下面的一步会报错
    //参考:https://jingyan.baidu.com/album/1974b2894d9573f4b1f77497.html?picindex=1
    右击我的电脑(This PC)
    选择Properties
    选择Advanced system settings
    选择Advanced页面右下方Environment Variables
    选择Path 选择New 把文件路径添加到输入框中 点击确定
  5. 安装dlib
    下载地址:http://dlib.net/
    选左下角Download dlib
    下载
    解压
    进入控制面板:
    进入dlib的解压目录(方法同上),输入:python setup.py install
    例如:
    C:\Users\z>cd C:\Users\z\s\dlib-19.17 回车
    C:\Users\z\s\dlib-19.17>python setup.py install
  6. 安装face_recognition
    重新打开cmd界面
    输入:pip install face_recognition 回车

运行阶段

参考 https://face-recognition.readthedocs.io/en/latest/readme.html

你可能感兴趣的:(利用Python实现人脸识别:face_recognition的安装)