无法在Pycharm中安装dlib(帮助)

2024-04-29 03:28:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试一个人脸识别项目,但是当我试图在pycharm中安装dlib时,我遇到了这个错误

Collecting dlib
  Using cached dlib-19.21.0.tar.gz (3.2 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
    Running setup.py install for dlib: started
    Running setup.py install for dlib: finished with status 'error'

DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.

ERROR: Command errored out with exit status 1:
 command: 'C:\Users\Alexis\.virtualenvs\pythonProject\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\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\Alexis\AppData\Local\Temp\pip-record-kq4elzu2\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Alexis\.virtualenvs\pythonProject\include\site\python3.9\dlib'
     cwd: C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\
Complete output (77 lines):
running install
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
Building extension for Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=C:\Users\Alexis\.virtualenvs\pythonProject\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\lib.win-amd64-3.9 -A x64'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version  to target Windows 10.0.19041.
CMake Error at CMakeLists.txt:14 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

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

    Build started 11/1/2020 2:39:22 PM.
    Project "C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\temp.win-amd64-3.9\Release\CMakeFiles\3.18.2\VCTargetsPath.vcxproj" on node 1 (default targets).
    C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\temp.win-amd64-3.9\Release\CMakeFiles\3.18.2\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\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\temp.win-amd64-3.9\Release\CMakeFiles\3.18.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\temp.win-amd64-3.9\Release\CMakeFiles\3.18.2\VCTargetsPath.vcxproj" (default target) (1) ->
      C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\build\temp.win-amd64-3.9\Release\CMakeFiles\3.18.2\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.14


  Exit code: 1



-- Configuring incomplete, errors occurred!
See also "C:/Users/Alexis/AppData/Local/Temp/pycharm-packaging/dlib/build/temp.win-amd64-3.9/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 223, in <module>
    setup(
  File "C:\Users\Alexis\.virtualenvs\pythonProject\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Alexis\.virtualenvs\pythonProject\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\command\install.py", line 546, in run
    self.run_command('build')
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 135, in run
    self.build_extension(ext)
  File "C:\Users\Alexis\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 172, in build_extension
    subprocess.check_call(cmake_setup, cwd=build_folder)
  File "C:\Users\Alexis\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\build\\lib.win-amd64-3.9', '-DPYTHON_EXECUTABLE=C:\\Users\\Alexis\\.virtualenvs\\pythonProject\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------

错误:命令出错,退出状态为1:

'C:\Users\Alexis\.virtualenvs\pythonProject\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Alexis\\AppData\\Local\\Temp\\pycharm-packaging\\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\Alexis\AppData\Local\Temp\pip-record-kq4elzu2\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Alexis\.virtualenvs\pythonProject\include\site\python3.9\dlib' Check the logs for full command output.
----------------------------------------------------------------------------

Tags: runinpybuildliblocalsetupusers