简体   繁体   English

无法为python安装face_recognition库

[英]unable to install face_recognition library for python

I'm trying to install dbLib Library for executing python face_recognition as mentioned here我正在尝试安装 dbLib 库来执行这里提到的 python face_recognition

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

as I execute the command python setup.py install --yes USE_AVX_INSTRUCTIONS当我执行命令 python setup.py install --yes USE_AVX_INSTRUCTIONS

it says the following它说以下

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!

please let me know what I'm doing wrong here请让我知道我在这里做错了什么

I was able to install it with pip (through the pip install face_recognition command) after I had Boost and CMake installed.安装 Boost 和 CMake 后,我能够使用 pip(通过 pip install face_recognition 命令)安装它。

to install face_recognition install Boost from here here and then install Cmake if both get successful then you can directly install it.安装face_recognition从这里安装升压这里,然后安装CMake如果同时获得成功,那么就可以直接安装。

and you also need to have visual studio C++ packages to ensure boost work properly并且您还需要有 Visual Studio C++ 包以确保 boost 正常工作

I had the same problem in py charm我在 py 魅力中遇到了同样的问题

face_recognition demands dlib. face_recognition 需要 dlib。

dlib demands cmake. dlib 需要 cmake。

But after you install the cmake its cannot be found, cause cmake is set as a environment variable.但是在安装 cmake 后找不到它,因为 cmake 被设置为环境变量。

So go at those steps:因此,请执行以下步骤:

  1. Download and install CMAKE ( https://cmake.org/download/ )下载并安装 CMAKE ( https://cmake.org/download/ )
  2. Go to System -> Advanced System Settings -> Environment Variables -> System Variables -> New... Variable name: CMAKE Variable value: C:\\Program Files\\CMake\\bin (Or where you installed the CMake bin directory)转到 System -> Advanced System Settings -> Environment Variables -> System Variables -> New... 变量名称:CMAKE 变量值:C:\\Program Files\\CMake\\bin(或安装 CMake bin 目录的位置)
  3. Run CMD运行命令
  4. pip install dlib (the processor will go full throttle on this) pip install dlib(处理器将全速运行)
  5. pip install face_recognition pip 安装 face_recognition

this issue may occur due to incorrect versions of cmake and dlib此问题可能是由于 cmake 和 dlib 的版本不正确造成的

just type只需输入

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

Make sure you have Visual Studio installed with C++ packages (C++11 library).确保你安装了带有 C++ 包(C++11 库)的 Visual Studio。 Also state exactly the content of Output log file.还要准确说明输出日志文件的内容。

I had a lot of trouble for downloading face_recognition in pycharm, but I finally figured it out.我在pycharm中下载face_recognition遇到了很多麻烦,但我终于弄明白了。

I went to Terminal and typed:我去了终端并输入:

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

Just make sure the latest version of pip is installed on your computer and you have CMae installed.只需确保您的计算机上安装了最新版本的 pip 并且您已经安装了 CMae。

Also, if you are trying to use dlib and/or face_recognition in a pycharm project you can follow the pictures below:此外,如果您尝试在 pycharm 项目中使用 dlib 和/或 face_recognition,您可以按照以下图片操作:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM