通过pip安装dlib库时出错

时间:2017-09-10 14:05:32

标签: python opencv cmake face-detection dlib

我不知道这有什么问题。我按照教程安装了Dlib。

这是我得到的两种方式和错误。我已经安装了其他已知的依赖项,如cmake,gcc,openCV。从dlib的官方网站下载了dlib 19.6。 Python版本是2.7。操作系统:Windows 10。

以下是来自cmd提示符的错误日志,用于双向安装。

C:\dlib-19.6\dlib-19.6>python setup.py install
running install
running bdist_egg
running build
Detected Python architecture: 32bit
Detected platform: win32
Removing build directory C:\dlib-19.6\dlib-19.6\./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 10-Sep-17 7:18:01 PM.
    Project "C:\dlib-19.6\dlib-19.6\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" on node 1 (default targets).
    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\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 selecting "Retarget solution". [C:\dlib-19.6\dlib-19.6\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
    Done Building Project "C:\dlib-19.6\dlib-19.6\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
    Build FAILED.
    "C:\dlib-19.6\dlib-19.6\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default target) (1) ->
    (Desktop_PlatformPrepareForBuild target) ->
      C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\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 selecting "Retarget solution". [C:\dlib-19.6\dlib-19.6\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
error: cmake configuration failed!

C:\dlib-19.6\dlib-19.6>

通过Python包安装程序

C:\Users\Hp>pip install dlib
Collecting dlib
  Using cached dlib-19.6.1.tar.gz
Building wheels for collected packages: dlib
  Running setup.py bdist_wheel for dlib ... error
  Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\hp\\appdata\\local\\temp\\pip-build-vwayhd\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d c:\users\hp\appdata\local\temp\tmp7vtii4pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  Detected Python architecture: 32bit
  Detected platform: win32
  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 10-Sep-17 7:28:49 PM.
      Project "C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" on node 1 (default targets).
      C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\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 selecting "Retarget solution". [C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
      Done Building Project "C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
      Build FAILED.
      "C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default target) (1) ->
      (Desktop_PlatformPrepareForBuild target) ->
        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\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 selecting "Retarget solution". [C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
          0 Warning(s)
          1 Error(s)
      Time Elapsed 00:00:00.71
    Exit code: 1
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/Hp/AppData/Local/Temp/pip-build-vwayhd/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
  error: cmake configuration failed!

  ----------------------------------------
  Failed building wheel for dlib
  Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
  Running setup.py install for dlib ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\hp\\appdata\\local\\temp\\pip-build-vwayhd\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\hp\appdata\local\temp\pip-7vl1fy-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    Detected Python architecture: 32bit
    Detected platform: win32
    Removing build directory c:\users\hp\appdata\local\temp\pip-build-vwayhd\dlib\./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 10-Sep-17 7:28:52 PM.
        Project "C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" on node 1 (default targets).
        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\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 selecting "Retarget solution". [C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
        Done Building Project "C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
        Build FAILED.
        "C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj" (default target) (1) ->
        (Desktop_PlatformPrepareForBuild target) ->
          C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\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 selecting "Retarget solution". [C:\Users\Hp\AppData\Local\Temp\pip-build-vwayhd\dlib\tools\python\build\CMakeFiles\3.9.0\VCTargetsPath.vcxproj]
            0 Warning(s)
            1 Error(s)
        Time Elapsed 00:00:00.73
      Exit code: 1
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/Hp/AppData/Local/Temp/pip-build-vwayhd/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
    error: cmake configuration failed!

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\hp\\appdata\\local\\temp\\pip-build-vwayhd\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\hp\appdata\local\temp\pip-7vl1fy-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\hp\appdata\local\temp\pip-build-vwayhd\dlib\

1 个答案:

答案 0 :(得分:1)

您的PC上未安装Windows SDK。下载Visual Studio安装程序并安装SDK。 enter image description here