window 10 上的 dlib 问题

dlib issue on window 10

pip 安装 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 ... error
    ERROR: Command errored out with exit status 1:
     command: 'f:\python\rio python\project rio\face_mmod_env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Rio\AppData\Local\Temp\pip-install-muznbbzz\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Rio\AppData\Local\Temp\pip-install-muznbbzz\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\Rio\AppData\Local\Temp\pip-record-4nvv4sbo\install-record.txt' --single-version-externally-managed --compile --install-headers 'f:\python\rio python\project rio\face_mmod_env\include\site\python3.8\dlib'
         cwd: C:\Users\Rio\AppData\Local\Temp\pip-install-muznbbzz\dlib\
    Complete output (64 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.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)]
    Invoking CMake setup: 'cmake C:\Users\Rio\AppData\Local\Temp\pip-install-muznbbzz\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Rio\AppData\Local\Temp\pip-install-muznbbzz\dlib\build\lib.win32-3.8 -DPYTHON_EXECUTABLE=f:\python\rio python\project rio\face_mmod_env\scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Rio\AppData\Local\Temp\pip-install-muznbbzz\dlib\build\lib.win32-3.8'
    -- Building for: Visual Studio 16 2019
    -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
    -- The C compiler identification is MSVC 19.27.29111.0
    -- The CXX compiler identification is MSVC 19.27.29111.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: F:/Python/Rio Python/Project Rio/face_mmod_env/Scripts/python.exe (found version "3.8.2")
    CMake Error at C:/Users/Rio/AppData/Local/Temp/pip-install-muznbbzz/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:124 (message):
      Python config failure: Python is 32-bit, chosen compiler is 64-bit
    Call Stack (most recent call first):
      C:/Users/Rio/AppData/Local/Temp/pip-install-muznbbzz/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:16 (find_package)
      C:/Users/Rio/AppData/Local/Temp/pip-install-muznbbzz/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)


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

我遵循的步骤:

1.Download 并安装 cmake 并为来自“https://cmake.org/download/”的所有用户设置系统路径 link

2.Installed visual studio 2019 并下载组件“c++ cmake 工具 window”

  1. 手动添加环境变量路径

  2. 运行 命令“pip install cmake” 成功

  3. pip 安装 dlib 我上面给出的错误

我正在使用 window 10 64 位

使用 python 64 位配置创建新的虚拟环境

运行 命令:

pip 安装 cmake

pip 安装 dlib

有效

谢谢@squareskittles