Windows安装face_recognition库
写在前面:
在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 dlibpip 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_Xset BOOST_LIBRARYDIR=C:\local\boost_X_XX_X\stage\libpython 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库的更多相关文章
- Windows安装face_recognition
安装提供的python和cmake,最好都添加一下环境变量 安装dlib,pip install dlib-19.7.0-cp36-cp36m-win_amd64.whl 安装face_recogni ...
- python-----windows下安装face_recognition库
如果直接在cmd命令界面 输入:pip install face_recognition 如下图所示: 如果第一次就会出现一系列的问题,解决此问题就安装如下步骤: 一.如果你本机没有安装vistual ...
- 人脸识别-关于face_recognition库的安装
首先十分感谢博客https://blog.csdn.net/scc_722/article/details/80613933,经历过很多尝试(快要醉了),终于看了这篇博客后安装成功. face_rec ...
- 重拾Python(2):如何安装第三方库(Windows)
使用python进行数据分析或者数据处理时,往往需要使用一些库,而使用库之前必须安装它.Anaconda内置了很多常用的第三方库,可以满足绝大部分需求,比如numpy.pandas.matplotli ...
- Windows下安装lxml库方法
如果直接用pip install lxml安装成功,那么恭喜!!! 一般在windows安装都十分蛋疼,pip无法直接安装(提示错误一大片,此处省略……) 因此选择wheel安装方式,步骤如下: 1. ...
- Windows环境下使用pip install安装lxml库
lxml是Python语言和XML以及HTML工作的功能最丰富和最容易使用的库.lxml是为libxml2和libxslt库的一个Python化的绑定.它与众不同的地方是它兼顾了这些库的速度和功能完整 ...
- windows下编译和安装boost库
boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...
- Python3.x(windows系统)安装matplotlib库
Python3.x(windows系统)安装matplotlib库 cmd命令: pip install matplotlib 执行结果:
- Python3.x(windows系统)安装requests库
Python3.x(windows系统)安装requests库 cmd命令: pip install requests 执行结果:
随机推荐
- Linux 集群 和免秘钥登录的方法。
/* 1.1.什么是集群? 很多台服务器(计算机)做相同的事,就称之为集群 服务器和服务器之间必须要处于联通状态(linux01和linux02可以相互访问并且传输数据) 服务器的配置和常见的计算机没 ...
- plsql 数据库事件触发器
--4.数据库事件触发器 需要超管的权限 /* 数据库事件触发器有数据库级和模式级两种. 前者定义在整个数据库上,触发事件是数据库事件,如数据库的启动.关闭,对数据库的登录或退出. 后者定义在模式上, ...
- C++ 构造函数、析构函数与虚函数的关系
编译环境:windows 10 + VS2105 1.构造函数不能为虚函数 虚函数的作用是为了实现C++多态机制.基类定义虚函数,子类可以重写该虚函数.当子类重写父类虚函数后,父类指针指向子类地址时, ...
- 解决Vue3使用 Ant Design,出现多个Modal,全是黑屏,导致列表页看不见问题!
尴尬问题 不报错,但是我看着就难受. 求知路上 请教了下强哥,强哥告诉我可能某个样式属性失效引起(无效),建议我F12看下样式. 接着,我F12狂看元素样式,查了一个小时未果,我真抓狂了. 都想明天问 ...
- Android编译implement、api 和compile区别【转】
感谢大佬:https://blog.csdn.net/fengyeNom1/article/details/81903186 前言 2017 年google 后,Android studio 版本更新 ...
- 学习jsp篇:jsp Session介绍
1.Session基本介绍 Session---会话,它是一个内置对象.会话打个比方说就是浏览网站:开始到结束,或者说购物从开始到结束. 2.Session机制 客户端在第一次请求服务端时,服务端会产 ...
- Java基础复习(四)
1.Integer与int的区别 int是java提供的8种原始数据类型之一.Java为每个原始类型提供了封装类,Integer是java为int提供的封装类.int的默认值为0,而Integer的默 ...
- Git修改提交历史中的作者及邮箱信息
一.使用rebase 如图,红圈中提交的用户名及邮箱是需要改的,则需要复制需要改的提交记录的上一个记录hashcode,在本例中就是a0a891a48f92b51201042fccbe61ed1264 ...
- vue 定义全局函数和变量
背景 最近我在整一个网站,介绍一些有意思的网站和实用工具的网站并且把他们收集起来,网站刚建有些不成熟希望给点意见 我用的是前端框架的vue, 但是我没有打包,直接甩到服务器上了, 不想扯了, 步骤 1 ...
- [LeetCode]20.有效的括号(Java)
原题地址: valid-parentheses 题目描述: 给定一个只包括 '(',')','{','}','[',']' 的字符串 s ,判断字符串是否有效. 有效字符串需满足: 左括号必须用相同类 ...