无法在 python 3 上安装 dlib

unable to install dlib on python 3

我正在尝试在 python 3.7 上安装 dlib,但总是失败

我已经安装了 cmake 并将其添加到我的环境中,我已经将我的 pip 升级到最新版本, 但每次我 运行

pip install dlib

它returns错误

Collecting dlib
  Using cached dlib-19.19.0.tar.gz (3.2 MB)
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\charles\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\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\Charles\AppData\Local\Temp\pip-record-xchasbrx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\charles\appdata\local\programs\python\python37\Include\dlib'
         cwd: C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\
    Complete output (74 lines):
    running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\users\charles\appdata\local\programs\python\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\lib.win-amd64-3.7 -A x64'
    -- Building for: Visual Studio 10 2010
    CMake Error at CMakeLists.txt:3 (project):
      Failed to run MSBuild command:

        C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe

      to get the value of VCTargetsPath:

        Microsoft (R) Build Engine version 4.8.3752.0
        [Microsoft .NET Framework, version 4.0.30319.42000]
        Copyright (C) Microsoft Corporation. All rights reserved.

        Build started 2/7/2020 12:37:32 PM.
        Project "C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" on node 1 (default targets).
        C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
        Done Building Project "C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.

        Build FAILED.

        "C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" (default target) (1) ->
          C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

            0 Warning(s)
            1 Error(s)

        Time Elapsed 00:00:00.01


      Exit code: 1



    -- Configuring incomplete, errors occurred!
    See also "C:/Users/Charles/AppData/Local/Temp/pip-install-6wd_c0pw/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "c:\users\charles\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\charles\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "c:\users\charles\appdata\local\programs\python\python37\lib\subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\users\charles\appdata\local\programs\python\python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\charles\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\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\Charles\AppData\Local\Temp\pip-record-xchasbrx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\charles\appdata\local\programs\python\python37\Include\dlib' Check the logs for full command output.

我也安装了通过:

  1. 到这里https://pypi.org/simple/dlib/
  2. 选择 dlib-19.18.0.tar.gz
  3. 解压,进入文件夹
  4. 打开命令行然后运行pythonsetup.py安装

returns:

running install
running bdist_egg
running egg_info
writing dlib.egg-info\PKG-INFO
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
package init file 'dlib\__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'tools\python\build*'
no previously-included directories found matching 'dlib\test'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\lib.win-amd64-3.7 -A x64'
CMake Error at CMakeLists.txt:3 (project):
  Failed to run MSBuild command:

    C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe

  to get the value of VCTargetsPath:

    Microsoft (R) Build Engine version 4.8.3752.0
    [Microsoft .NET Framework, version 4.0.30319.42000]
    Copyright (C) Microsoft Corporation. All rights reserved.

    Build started 2/7/2020 12:21:15 PM.
    Project "C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" on node 1 (default targets).
    C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
    Done Building Project "C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" (default target) (1) ->
      C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

        0 Warning(s)
        1 Error(s)

    Time Elapsed 00:00:00.06


  Exit code: 1



-- Configuring incomplete, errors occurred!
See also "C:/Users/Charles/Downloads/dlib-19.18.0.tar/dist/dlib-19.18.0/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "setup.py", line 261, in <module>
    'Topic :: Software Development',
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\install.py", line 67, in run
    self.do_egg_install()
  File "C:\Users\Charles\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\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Charles\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\Charles\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\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 135, in run
    self.build_extension(ext)
  File "setup.py", line 172, in build_extension
    subprocess.check_call(cmake_setup, cwd=build_folder)
  File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.

我还尝试从源代码安装它:

python -m pip install  https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz#sha256=8ca127253a0ca82a3d847148515f82ff2c504ed77a6385ec4f38c7f8e5360860

它返回 错误 作为

Collecting https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz#sha256=8ca127253a0ca82a3d847148515f82ff2c504ed77a6385ec4f38c7f8e5360860
  Using cached dlib-19.18.0.tar.gz (3.1 MB)
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\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\Charles\AppData\Local\Temp\pip-record-waso8gw6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Charles\AppData\Local\Programs\Python\Python37\Include\dlib'
         cwd: C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\
    Complete output (74 lines):
    running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\lib.win-amd64-3.7 -A x64'
    -- Building for: Visual Studio 10 2010
    CMake Error at CMakeLists.txt:3 (project):
      Failed to run MSBuild command:

        C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe

      to get the value of VCTargetsPath:

        Microsoft (R) Build Engine version 4.8.3752.0
        [Microsoft .NET Framework, version 4.0.30319.42000]
        Copyright (C) Microsoft Corporation. All rights reserved.

        Build started 2/7/2020 12:53:19 PM.
        Project "C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" on node 1 (default targets).
        C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
        Done Building Project "C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.

        Build FAILED.

        "C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj" (default target) (1) ->
          C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\temp.win-amd64-3.7\Release\CMakeFiles.16.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

            0 Warning(s)
            1 Error(s)

        Time Elapsed 00:00:00.01


      Exit code: 1



    -- Configuring incomplete, errors occurred!
    See also "C:/Users/Charles/AppData/Local/Temp/pip-req-build-k3302dt_/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:\Users\Charles\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\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\Charles\AppData\Local\Temp\pip-record-waso8gw6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Charles\AppData\Local\Programs\Python\Python37\Include\dlib' Check the logs for full command output.

我很迷茫,任何回应或建议将不胜感激。谢谢

  1. Python 3.6(64 位)必须已经安装。
  2. 运行 Windows 提示命令。 您可以在搜索栏上输入“CMD”。 记得点鼠标右键然后“运行以管理员身份”,否则可能没有权限安装库
  3. 在提示符下输入命令

python -m pip 安装https://files.pythonhosted.org/packages/0e/ce/f8a3cff33ac03a8219768f0694c5d703c8e037e6aba2e865f9bae22ed63c/dlib-19.8.1-cp36-cp36m-win_amd64.whl#sha256=794994fa2c54e7776659fddb148363a5556468a6d5d46be8dad311722d54bfcf 4. 看到“Successfully installed dlib”的提示,表示安装完成

通过使用 C++ 安装 VS 解决。

你自己想出来了,但我想对你的安装方法做一些说明:

pip install dlib

因为 pypi 上只有 tar.gz,它会下载它,然后在安装 reuqirements

后尝试 运行 setup.py

因此,您手动执行 tar.gz,提取它并 运行ning python setup.py install 与第一个命令和

是一样的
python -m pip install  https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz

最后也是这样,正在尝试运行setup.py安装

在这种情况下,它涉及 c/c++ 代码的编译,这需要安装正确的 compiler/build 工具,而 pip 无法处理。它不是为此任务而构建的。

请设置您的编译器路径变量:

export CC=/usr/bin/gcc

然后再次执行 pip install dlib。它应该工作。您可能还想查看 usr/bin gcc 的正确路径。