使用pip命令在Windows中安装dlib时出错

时间:2018-09-05 05:53:54

标签: python-3.x dlib

我进行了pip安装,以在系统中安装dlib。我安装了CMake,甚至将其添加到PATH中。但是我得到这个错误

-- Building for: NMake Makefiles
  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 "C:/Users/Srikanth1.R/AppData/Local/Temp/pip-install-aun_5hei/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\setup.py", line 257, in <module>
      'Topic :: Software Development',
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
      self.run_command('build')
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\setup.py", line 133, in run
      self.build_extension(ext)
    File "C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\setup.py", line 170, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\subprocess.py", line 291, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\srikanth1.r\\appdata\\local\\continuum\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.

  ----------------------------------------
  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:\users\srikanth1.r\appdata\local\continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\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\SRIKAN~1.R\AppData\Local\Temp\pip-record-lcbc0691\install-record.txt --single-version-externally-managed --compile:
    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.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\users\srikanth1.r\appdata\local\continuum\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\build\lib.win-amd64-3.6 -A x64'
    -- Building for: NMake Makefiles
    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 "C:/Users/Srikanth1.R/AppData/Local/Temp/pip-install-aun_5hei/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\setup.py", line 257, in <module>
        'Topic :: Software Development',
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\setup.py", line 133, in run
        self.build_extension(ext)
      File "C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\setup.py", line 170, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\lib\subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\srikanth1.r\\appdata\\local\\continuum\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.

    ----------------------------------------
Command "c:\users\srikanth1.r\appdata\local\continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SRIKAN~1.R\\AppData\\Local\\Temp\\pip-install-aun_5hei\\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\SRIKAN~1.R\AppData\Local\Temp\pip-record-lcbc0691\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SRIKAN~1.R\AppData\Local\Temp\pip-install-aun_5hei\dlib\

还有更多错误。但是我认为这些错误是由于我提到的这个错误。

我有Windows 10和python 3.6。我已经安装了CMake版本3.11.4

对此有什么解决方案吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

请安装Visual Studio社区。 它不是IDE。它的安装程序包含支持C / C ++的不同环境 在安装之前,请勾选那些C / C ++部分。 下载和安装需要2个小时以上的时间,然后重新启动,具体取决于网速 重新启动后,尝试安装dlib 效果很好 在那之前希望你安装 蟒蛇 点子 cmake

enter image description here