无法安装 dlib 和 face_recognition 窗口

Posted

技术标签:

【中文标题】无法安装 dlib 和 face_recognition 窗口【英文标题】:Unable to install dlib and face_recognition windows 【发布时间】:2021-07-06 13:10:27 【问题描述】:

我一直在尝试在 anaconda 中安装 dlib 和 face_recognition,但未能成功。 我确实安装了visual studio和cmake并尝试了它。仍然显示以下错误

ERROR: Command errored out with exit status 1:
   command: 'C:\Users\gauta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\setup.py'"'"'; __file__='"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\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\gauta\AppData\Local\Temp\pip-wheel-rratsgq6'
       cwd: C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\
  Complete output (58 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
  running build_ext
  Building extension for Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
  Invoking CMake setup: 'cmake C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\gauta\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\build\lib.win-amd64-3.8 -A x64'
  -- Building for: NMake Makefiles
  CMake Error at CMakeLists.txt:5 (message):
  
  
  
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
    You must use Visual Studio to build a python extension on windows.  If you
    are getting this error it means you have not installed Visual C++.  Note
    that there are many flavors of Visual Studio, like Visual Studio for C#
    development.  You need to install Visual Studio for C++.
  
  
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
  
  
  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\setup.py", line 222, in <module>
      setup(
    File "C:\Users\gauta\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\gauta\anaconda3\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\gauta\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\gauta\anaconda3\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\setup.py", line 134, in run
      self.build_extension(ext)
    File "C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\setup.py", line 171, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:\Users\gauta\anaconda3\lib\subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\gauta\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for dlib
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\gauta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\setup.py'"'"'; __file__='"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\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\gauta\AppData\Local\Temp\pip-record-ex8cq73s\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\gauta\anaconda3\Include\dlib'
         cwd: C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\
    Complete output (60 lines):
    running install
    running build
    running build_py
    package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\gauta\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\build\lib.win-amd64-3.8 -A x64'
    -- Building for: NMake Makefiles
    CMake Error at CMakeLists.txt:5 (message):
    
    
    
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    
      You must use Visual Studio to build a python extension on windows.  If you
      are getting this error it means you have not installed Visual C++.  Note
      that there are many flavors of Visual Studio, like Visual Studio for C#
      development.  You need to install Visual Studio for C++.
    
    
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    
    
    
    -- Configuring incomplete, errors occurred!
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\setup.py", line 222, in <module>
        setup(
      File "C:\Users\gauta\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\gauta\anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\gauta\anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Users\gauta\anaconda3\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\gauta\anaconda3\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\setup.py", line 134, in run
        self.build_extension(ext)
      File "C:\Users\gauta\AppData\Local\Temp\pip-install-rdfv1j3q\dlib_bcbfbd93661e42b88d867f964c16a67b\setup.py", line 171, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:\Users\gauta\anaconda3\lib\subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\gauta\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\gauta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\setup.py'"'"'; __file__='"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-rdfv1j3q\\dlib_bcbfbd93661e42b88d867f964c16a67b\\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\gauta\AppData\Local\Temp\pip-record-ex8cq73s\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\gauta\anaconda3\Include\dlib' Check the logs for full command output.

  Using cached dlib-19.22.0.tar.gz (7.4 MB)
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py): started
  Building wheel for dlib (setup.py): finished with status 'error'
  Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
    Running setup.py install for dlib: started
    Running setup.py install for dlib: finished with status 'error'
Requirement already satisfied: face_recognition in c:\users\gauta\anaconda3\lib\site-packages (1.3.0)
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\gauta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\setup.py'"'"'; __file__='"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\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\gauta\AppData\Local\Temp\pip-wheel-ta0px1h7'
       cwd: C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\
  Complete output (58 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
  running build_ext
  Building extension for Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
  Invoking CMake setup: 'cmake C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\gauta\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\build\lib.win-amd64-3.8 -A x64'
  -- Building for: NMake Makefiles
  CMake Error at CMakeLists.txt:5 (message):
  
  
  
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
    You must use Visual Studio to build a python extension on windows.  If you
    are getting this error it means you have not installed Visual C++.  Note
    that there are many flavors of Visual Studio, like Visual Studio for C#
    development.  You need to install Visual Studio for C++.
  
  
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
  
  
  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\setup.py", line 222, in <module>
      setup(
    File "C:\Users\gauta\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\gauta\anaconda3\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\gauta\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\gauta\anaconda3\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\setup.py", line 134, in run
      self.build_extension(ext)
    File "C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\setup.py", line 171, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:\Users\gauta\anaconda3\lib\subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\gauta\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for dlib
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\gauta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\setup.py'"'"'; __file__='"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\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\gauta\AppData\Local\Temp\pip-record-9ezrxamk\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\gauta\anaconda3\Include\dlib'
         cwd: C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\
    Complete output (60 lines):
    running install
    running build
    running build_py
    package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\gauta\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\build\lib.win-amd64-3.8 -A x64'
    -- Building for: NMake Makefiles
    CMake Error at CMakeLists.txt:5 (message):
    
    
    
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    
      You must use Visual Studio to build a python extension on windows.  If you
      are getting this error it means you have not installed Visual C++.  Note
      that there are many flavors of Visual Studio, like Visual Studio for C#
      development.  You need to install Visual Studio for C++.
    
    
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    
    
    
    -- Configuring incomplete, errors occurred!
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\setup.py", line 222, in <module>
        setup(
      File "C:\Users\gauta\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\gauta\anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\gauta\anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Users\gauta\anaconda3\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\gauta\anaconda3\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\gauta\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\gauta\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\setup.py", line 134, in run
        self.build_extension(ext)
      File "C:\Users\gauta\AppData\Local\Temp\pip-install-a5gk8c_j\dlib_8dc7528b82bb41ef999809e36e6df816\setup.py", line 171, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:\Users\gauta\anaconda3\lib\subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\gauta\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\gauta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\setup.py'"'"'; __file__='"'"'C:\\Users\\gauta\\AppData\\Local\\Temp\\pip-install-a5gk8c_j\\dlib_8dc7528b82bb41ef999809e36e6df816\\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\gauta\AppData\Local\Temp\pip-record-9ezrxamk\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\gauta\anaconda3\Include\dlib' Check the logs for full command output.

我在这里缺少什么?我查看了来自不同来源的所有解决方案。

    安装 CMake 并查找路径变量,它存在。 已安装 Visual Studio 构建工具,但仍显示为不存在,按上述错误。

谁能告诉我这里出了什么问题??

【问题讨论】:

【参考方案1】:

我可以从你的 PATH 中看到你有 conda。您可以使用来自 conda-forge 频道的预编译版本。

# create environment with any name 
# and install dlib and face_recognition from conda-forge channel 

conda create --name faces python=3.7 dlib face_recognition --channel conda-forge

要使用,激活环境并使用你的包

conda activate faces
python -c "import face_recognition"

如果你有 GPU,这将不会使用你的 GPU。为此,我们必须从与您的特定 GPU 设置匹配的源代码构建 dlib。这需要更多的工作。查看另一个 SO 论坛dlib installation on Windows 10

【讨论】:

所以当我尝试这个时,我得到一个新错误(基础) C:\WINDOWS\system32>conda create --name faces python=3.7 dlib face_recognition --channel conda-forge 收集包元数据( current_repodata.json):失败 NotWritableError:当前用户没有对所需路径的写入权限。路径:C:\Users\gauta\anaconda3\pkgs\cache\f7597cf7.json 这是因为您在C:\WINDOWS\system32&gt; 您需要管理员权限才能在该文件夹中安装任何内容。尝试 Documents 或任何其他地方 我做到了。将其更改为其他文件夹。仍然给出同样的问题。 你在哪个文件夹?可以试试 Documents 文件夹吗?【参考方案2】:

您可以尝试这种方式在此处下载压缩文件https://github.com/CodeEZ-Dev/face-recognition_dlib_library 并将其解压缩到 C:\Users 位置。然后打开命令提示符并运行***pip install dlib-19.19.0-cp38-cp38-win_amd64.whl,如果您使用的是 python 版本 3.8。这将安装 dlib,之后安装 face_recognition 时不会抛出错误。

【讨论】:

以上是关于无法安装 dlib 和 face_recognition 窗口的主要内容,如果未能解决你的问题,请参考以下文章

python3安装dlib库和face_recognition库

win64位系统+Anacond(python3.6)避坑快速安装Dlib+Face_recognition

Python Face_Recognition - Cmake | Dlib 安装错误窗口

来自 dlib.image_window 的 Dlib face_recognition 错误

带有opencv和dlib face_recognition库的人脸识别考勤系统给出不正确的识别

dlib 和 face_recognition 库出错