python-3.x “错误:必须安装CMake才能构建dlib”当我已经安装了CMake并添加了它的路径时

bihw5rsg  于 2023-02-26  发布在  Python
关注(0)|答案(1)|浏览(620)

我已经安装了cmake并将其添加到路径中。
下面是我尝试使用pip安装dlib时出现的错误:

C:\Users\Zack\AppData\Local\Programs\Python\Python39\Scripts>pip install dlib
Collecting dlib
  Using cached dlib-19.24.0.tar.gz (3.2 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext

      ERROR: CMake must be installed to build dlib

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: 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
  error: subprocess-exited-with-error

  × Running setup.py install for dlib did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      running install
      C:\Users\Zack\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      running build_ext

      ERROR: CMake must be installed to build dlib

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> dlib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

我试着下载dlib wheel并像这样安装它:

C:\Users\Zack\AppData\Local\Programs\Python\Python39\Scripts>pip install "D:\Users\ZACK\Downloads\dlib-18.17.100-cp27-none-win32.whl"

产出

ERROR: dlib-18.17.100-cp27-none-win32.whl is not a supported wheel on this platform.

我试着用url安装轮子:

C:\Users\Zack\AppData\Local\Programs\Python\Python39\Scripts> pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f

产出

ERROR: dlib-19.7.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
1sbrub3j

1sbrub3j1#

你的cmake路径不在path中。我希望在安装这个包后它会有帮助。
软件包的选择不能是任意的,在您的情况下,dlib-19.7.0-cp 36-cp 36 m-win_amd 64.whl可能不是合适的。
尝试运行“pip debug --verbose“,然后查看哪个版本与上面命令输出中给出的版本匹配。然后,只有wheel版本受支持,才会安装。

相关问题