写在前面:

在pip官网搜face_recognition https://pypi.org/project/face_recognition/

介绍中可看出该包更适合在Linux系统中使用,但也附上了在Windows系统中安装的须知:https://github.com/ageitgey/face_recognition/issues/175#issue-257710508

另外其他几个参考链接:https://blog.csdn.net/wyc12306/article/details/79286361

https://blog.csdn.net/Im1smb/article/details/78073563#t6

https://my.oschina.net/u/2428854/blog/1797473

https://www.jianshu.com/p/eb4bec6459c7

结合自己实际操作的过程,总结如下:

必须:

  • 安装了C/C++ 编译器的Microsoft Visual Studio 2015 问题①
  • Boost 库,V1.63或者更新的版本 问题②
  • Python3
  • CMake,Windows安装时要将其路径加入环境变量 问题③
  • face_recognition一般要配合OpenCV使用,附上手动安装OpenCV包的教程:http://www.ywlib.com/archives/39.html

安装:

使用pip:

  • pip install dlib
  • pip install face_recognition

手动安装:

  • 1.下载并安装 scipy 和 numpy+mkl(must be mkl version)包,网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/  下载与你的python版本相对应的版本。
  • 2. 针对你当前的MSVC下载 Boost 库的源代码或二进制版本,网址:https://sourceforge.net/projects/boost/files/  编译boost
  • 3.下载最新版本的 dlib 并解压它,网址:https://github.com/davisking/dlib
    • 到dlib的路径下,打开cmd命令行窗口,输入:
    • set BOOST_ROOT=C:\local\boost_X_XX_X
    • set BOOST_LIBRARYDIR=C:\local\boost_X_XX_X\stage\lib
    • python setup.py install
  • 4. 安装成功后,进入python解释器输入 import dlib 或 pip show dlib 验证是否安装成功
  • 5. 输入 pip install face_recognition 安装face_recognition包

问题①:

本机已安装Visual Studio 2017,可打开Visual Studio Installer,点击“修改”,工作负载中勾选“使用C++的桌面开发”

单个组件中勾选:

安装。

问题②:

cmd命令行窗口进入boost_1_71_0,输入bootstrap.bat,如果报错,查看bootstrap.log

LOCALAPPDATA=C:\Users\F68OHG\AppData\Local
Found with vswhere Visual Studio Locator version 2.5.2+gebb9f26a3d [query version 1.18.21.37008]
###
### "Unknown toolset: vcunk"
###
### You can specify the toolset as the argument, i.e.:
###     .\build.bat msvc
###
### Toolsets supported by this script are: borland, como, gcc,
###     gcc-nocygwin, intel-win32, metrowerks, mingw,
###     vc11, vc12, vc14, vc141, vc142
###
### If you have Visual Studio 2017 installed you will need to either update
### the Visual Studio 2017 installer or run from VS 2017 Command Prompt
### as we where unable to detect your toolset installation.
###

按照提示,使用Visual Studio的命令行窗口,

改为输入.\bootstrap.bat  msvc

就会开始编译,过程大概半小时。

问题③:

参考:CSDN博主「Toblerone_Wind」https://blog.csdn.net/qq_42276781/article/details/88594870

本来在CMake官网下载并安装了CMake,但在安装dlib的时候报错:

Building extension for Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
Invoking CMake setup: 'cmake E:\dlib-19.15\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\dlib-19.15\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\87328\AppData\Local\Programs\Python\Python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=E:\dlib-19.15\build\lib.win-amd64-3.7 -A x64'
CMake Error in CMakeLists.txt:
  Generator

    NMake Makefiles

  does not support platform specification, but platform

    x64

  was specified.

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "E:/dlib-19.15/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "setup.py", line 257, in <module>
    'Topic :: Software Development',
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\install.py", line 67, in run
    self.do_egg_install()
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 133, in run
    self.build_extension(ext)
  File "setup.py", line 170, in build_extension
    subprocess.check_call(cmake_setup, cwd=build_folder)
  File "C:\Users\87328\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 328, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'E:\\dlib-19.15\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\\dlib-19.15\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Users\\87328\\AppData\\Local\\Programs\\Python\\Python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=E:\\dlib-19.15\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.

其中,根据:

推断是CMake的版本不匹配,于是使用在Visual Studio Installer安装CMake的方式,单个组件中,勾选“用于CMake的Visual C++工具”:

然后配置一下path,计算机→属性→高级系统设置→环境变量→Path→编辑→加入C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin  后确定(这个路径改为你本机的CMake的路径)

重启,重复上一步骤,出现下面界面就是好啦:

Windows安装face_recognition库的更多相关文章

  1. Windows安装face_recognition

    安装提供的python和cmake,最好都添加一下环境变量 安装dlib,pip install dlib-19.7.0-cp36-cp36m-win_amd64.whl 安装face_recogni ...

  2. python-----windows下安装face_recognition库

    如果直接在cmd命令界面 输入:pip install face_recognition 如下图所示: 如果第一次就会出现一系列的问题,解决此问题就安装如下步骤: 一.如果你本机没有安装vistual ...

  3. 人脸识别-关于face_recognition库的安装

    首先十分感谢博客https://blog.csdn.net/scc_722/article/details/80613933,经历过很多尝试(快要醉了),终于看了这篇博客后安装成功. face_rec ...

  4. 重拾Python(2):如何安装第三方库(Windows)

    使用python进行数据分析或者数据处理时,往往需要使用一些库,而使用库之前必须安装它.Anaconda内置了很多常用的第三方库,可以满足绝大部分需求,比如numpy.pandas.matplotli ...

  5. Windows下安装lxml库方法

    如果直接用pip install lxml安装成功,那么恭喜!!! 一般在windows安装都十分蛋疼,pip无法直接安装(提示错误一大片,此处省略……) 因此选择wheel安装方式,步骤如下: 1. ...

  6. Windows环境下使用pip install安装lxml库

    lxml是Python语言和XML以及HTML工作的功能最丰富和最容易使用的库.lxml是为libxml2和libxslt库的一个Python化的绑定.它与众不同的地方是它兼顾了这些库的速度和功能完整 ...

  7. windows下编译和安装boost库

    boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...

  8. Python3.x(windows系统)安装matplotlib库

    Python3.x(windows系统)安装matplotlib库 cmd命令: pip install matplotlib 执行结果:

  9. Python3.x(windows系统)安装requests库

    Python3.x(windows系统)安装requests库 cmd命令: pip install requests 执行结果:

随机推荐

  1. 布客·ApacheCN 编程/后端/大数据/人工智能学习资源 2021.7

    公告 ApacheCN 翻译预计将于半年内恢复. 我们的开源项目必须有中文的 README,如果是文档类项目,必须全部中文,否则将会被清理.请大家贡献项目时一定要留意. 我们目标是[财务自由+情感自由 ...

  2. ApacheCN jQuery 译文集 20211121 更新

    创建 jQueryMobile 移动应用 零.序言 一.jQueryMobile 原型制作 二.jQuery Mobile 网站 三.分析.长表单和前端验证 四.QR 码.地理位置.谷歌地图 API ...

  3. git init和git init –bare的区别:

    感谢原文作者:ljchlx 原文链接:https://blog.csdn.net/ljchlx/article/details/21805231 git init 和 git init –bare 的 ...

  4. Win10 提示凭证不工作问题

    感谢大佬:https://cloud.tencent.com/developer/article/1337081 在公司局域网远程自己计算机的时候,突然无法远程了,提示"您的凭据不工作 之前 ...

  5. 认识Visual C++ 6.0工程结构

  6. Mac 配置Apache Php编译ssl错误解决

    终端 Php编译错误解决 //错误信息 unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) i ...

  7. 「2022」打算跳槽涨薪,必问面试题及答案 -- ECMAScript 篇

    起点低怕什么,大不了加倍努力.人生就像一场马拉松比赛,拼的不是起点,而是坚持的耐力和成长的速度.只要努力不止,进步也会不止. 1.ECMAScript 与 JavaScript 的关系? ECMA(E ...

  8. 使用污点分析检查log4j问题

    摘要:log4j问题的余波还在继续,为什么这个问题潜伏了这么长时间,大家一直没有发现?这里从静态分析的角度谈下log4j问题的发现. 本文分享自华为云社区<使用污点分析检查log4j问题> ...

  9. HGAME第一二周re

    RE easyasm 有手就行 高低位互换再异或0x17 a = [0x91, 0x61, 0x01, 0xC1, 0x41, 0xA0, 0x60, 0x41, 0xD1, 0x21, 0x14, ...

  10. dbTable

    标签: <my-Double-Table double-Table="doubleTable" head-List="headList" select-M ...