1. 首页 >后端开发 >Python >

记一次安装 dlib失败的过程

在安装dlib的时候安装几次都失败

出现没有  cmake模块

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

  ╰─> [11 lines of output]

      running bdist_wheel

      running build

      running build_ext

      Traceback (most recent call last):

        File "<frozen runpy>", line 198, in _run_module_as_main

        File "<frozen runpy>", line 88, in _run_code

        File "C:\Python311\Scripts\cmake.exe\__main__.py", line 4, in <module>

      ModuleNotFoundError: No module named 'cmake'


      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

Failed to build dlib

ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)

试了很多次都无解 只能在

https://pypi.tuna.tsinghua.edu.cn/simple/dlib/

下载包来安装

我下载的是dlib-19.24.5.tar.gz

下载好解压出来

定位到对应的目录

执行 

python setup.py install 

经过几分钟的等待终于安装成功