我如何安装 dlib 来解决这个错误?

问题描述 投票:0回答:1

我正在尝试下载dlib以将face_recognition导入python,我已经下载了cmake(版本3.29.1)我已经从Microsoft下载了桌面开发c ++工具,并且我还安装了python(版本3.12.2) 我也已经有了环境变量“C:\Users\mynama\AppData\Local\Programs\Python\Python312” 有人可以帮我吗?

pip install dlib Collecting dlib   Using cached dlib-19.24.4.tar.gz (3.3 MB)   Installing build dependencies ... done   Getting requirements to build wheel ... done   Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: dlib Building wheel for dlib (pyproject.toml) ... error   error: subprocess-exited-with-error

  × Building wheel for dlib (pyproject.toml) did not run successfully. │ exit code: 1   ╰─> [143 lines of output]
      <string>:210: SyntaxWarning: invalid escape sequence '\('
      <string>:211: SyntaxWarning: invalid escape sequence '\('
      <string>:212: SyntaxWarning: invalid escape sequence '\('
      running bdist_wheel
      running build
      running build_ext
      <string>:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      Building extension for Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)]
      Invoking CMake setup: 'cmake C:\Users\andre.pimentel\AppData\Local\Temp\pip-install-88y5mi18\dlib_5093a421ca20445ab77f1ec7f4eced53\tools\python
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\andre.pimentel\AppData\Local\Temp\pip-install-88y5mi18\dlib_5093a421ca20445ab77f1ec7f4eced53\build\lib.win-amd64-cpython-312
-DPYTHON_EXECUTABLE=C:\Users\andre.pimentel\AppData\Local\Programs\Python\Python312\python.exe
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\andre.pimentel\AppData\Local\Temp\pip-install-88y5mi18\dlib_5093a421ca20445ab77f1ec7f4eced53\build\lib.win-amd64-cpython-312
-A x64'
      -- Building for: Visual Studio 17 2022
      -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
      -- The C compiler identification is MSVC 19.39.33523.0
      -- The CXX compiler identification is MSVC 19.39.33523.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - broken
      CMake Error at C:/Program Files/cmake-3.29.1-windows-x86_64/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
        The C compiler

          "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe"

无法编译简单的测试程序。

失败并显示以下输出:

          Change Dir: 'C:/Users/andre.pimentel/AppData/Local/Temp/pip-install-88y5mi18/dlib_5093a421ca20445ab77f1ec7f4eced53/build/temp.win-amd64-cpython-312/Release/CMakeFiles/CMakeScratch/TryCompile-fy734e'

          Run Build Command(s): "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_7bd2c.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
          MSBuild version 17.9.8+b34f75857 for .NET Framework
          Build started 4/8/2024 12:48:24 PM.

          Project "C:\Users\andre.pimentel\AppData\Local\Temp\pip-install-88y5mi18\dlib_5093a421ca20445ab77f1ec7f4eced53\build\temp.win-amd64-cpython-312\Release\CMakeFiles\CMakeScratch\TryCompile-fy734e\cmTC_7bd2c.vcxproj" on node 1 (default targets).
          PrepareForBuild:
            Creating directory "cmTC_7bd2c.dir\Debug\".
            Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
            Creating directory "C:\Users\andre.pimentel\AppData\Local\Temp\pip-install-88y5mi18\dlib_5093a421ca20445ab77f1ec7f4eced53\build\temp.win-amd64-cpython-312\Release\CMakeFiles\CMakeScratch\TryCompile-fy734e\Debug\".
            Creating directory "cmTC_7bd2c.dir\Debug\cmTC_7bd2c.tlog\".
          InitializeBuildStatus:
            Creating "cmTC_7bd2c.dir\Debug\cmTC_7bd2c.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
            Touching "cmTC_7bd2c.dir\Debug\cmTC_7bd2c.tlog\unsuccessfulbuild".
python cmake dlib
1个回答
0
投票

我已经设法解决了这个问题,我必须下载3.11.9的python版本,我去了这个github并下载了cpp 311,这是我现在拥有的python版本,谢谢大家

© www.soinside.com 2019 - 2024. All rights reserved.