无法为python安装face_recognition库

时间:2018-01-08 19:22:46

标签: python

我正在尝试安装dbLib Library来执行python face_recognition,如此处所述

https://github.com/ageitgey/face_recognition/issues/175#issuecomment-355899230

当我执行命令时 python setup.py install --yes USE_AVX_INSTRUCTIONS

它说以下

C:\Python\dblib\dlib-master>python setup.py install --yes USE_AVX_INSTRUCTIONS -
-yes DLIB_USE_CUDA
running install
running bdist_egg
running build
Detected Python architecture: 32bit
Detected platform: win32
Removing build directory C:\Python\dblib\dlib-master\./tools/python/build
Configuring cmake ...
-- Building for: Visual Studio 14 2015
CMake Error in CMakeLists.txt:
  Failed to run MSBuild command:
    C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
  to get the value of VCTargetsPath:
    Microsoft (R) Build Engine version 14.0.25420.1
    Copyright (C) Microsoft Corporation. All rights reserved.
    Build started 1/9/2018 12:16:21 AM.
    Project "C:\Python\dblib\dlib-master\tools\python\build\CMakeFiles\3.10.0\VC
TargetsPath.vcxproj" on node 1 (default targets).
    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\Platf
ormToolsets\v140\Toolset.targets(34,5): error MSB8036: The Windows SDK version 8
.1 was not found. Install the required version of Windows SDK or change the SDK
version in the project property pages or by right-clicking the solution and sele
cting "Retarget solution". [C:\Python\dblib\dlib-master\tools\python\build\CMake
Files\3.10.0\VCTargetsPath.vcxproj]
    Done Building Project "C:\Python\dblib\dlib-master\tools\python\build\CMakeF
iles\3.10.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
    Build FAILED.
    "C:\Python\dblib\dlib-master\tools\python\build\CMakeFiles\3.10.0\VCTargetsP
ath.vcxproj" (default target) (1) ->
    (Desktop_PlatformPrepareForBuild target) ->
      C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\Pla
tformToolsets\v140\Toolset.targets(34,5): error MSB8036: The Windows SDK version
 8.1 was not found. Install the required version of Windows SDK or change the SD
K version in the project property pages or by right-clicking the solution and se
lecting "Retarget solution". [C:\Python\dblib\dlib-master\tools\python\build\CMa
keFiles\3.10.0\VCTargetsPath.vcxproj]
        0 Warning(s)
        1 Error(s)
    Time Elapsed 00:00:00.09
  Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Python/dblib/dlib-master/tools/python/build/CMakeFiles/CMakeOutput.
log".
error: cmake configuration failed!

请让我知道我在这里做错了什么

5 个答案:

答案 0 :(得分:1)

在安装了Boost和CMake后,我能够使用pip(通过pip install face_recognition命令)安装它。

从此处安装face_recognition安装Boost here 然后安装Cmake如果两者都成功,那么你可以直接安装它。

并且您还需要使用visual studio C ++包以确保正常工作

答案 1 :(得分:0)

我在py魅力上也遇到了同样的问题

face_recognition需要dlib。

dlib要求cmake。

但是在安装cmake之后,找不到它,原因是将cmake设置为环境变量。

因此请执行以下步骤:

  1. 下载并安装CMAKE(https://cmake.org/download/
  2. 转到系统->高级系统设置->环境变量->系统变量->新建... 变量名称:CMAKE 变量值:C:\ Program Files \ CMake \ bin(或安装CMake bin目录的位置)
  3. 运行CMD
  4. pip install dlib(处理器将对此进行全面控制)
  5. pip install face_recognition

答案 2 :(得分:0)

此问题可能是由于cmake和dlib版本不正确

只需键入

pip install dlib == 19.18 和 pip install cmake == 3.18.4.post1

答案 3 :(得分:-1)

确保安装了带有C ++包(C ++ 11库)的Visual Studio。还要准确说明输出日志文件的内容。

答案 4 :(得分:-1)

在pycharm中下载face_recognition时遇到了很多麻烦,但是我终于明白了。

我去了Terminal并输入:

sudo pip install --upgrade pip
sudo pip install cmake
sudo pip install dlib
sudo pip install face_recognition

只需确保计算机上已安装最新版本的pip,并且已安装CMae。

此外,如果您尝试在pycharm项目中使用dlib和/或face_recognition,则可以遵循以下图片: