站点图标 AI技术聚合

python之dlib包安装失败问题及解决

python之dlib包安装失败问题及解决

dlib包安装失败 python

安装dlib时报错

Running setup.py install for dlib … error
ERROR: Command errored out with exit status 1:
command: ‘d:softwaresetuppythonpython.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] =

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File “<string>”, line 1, in <module>
  File “C:UsersyaoqifaAppDataLocalTemppip-install-u6nbqcm2dlibsetup.py”, line 261, in <module>
    ‘Topic :: Software Development’,
  File “C:UsersyaoqifaAppDataRoamingPythonPython37site-packagessetuptools__init__.py”, line 144, in setup
    return distutils.core.setup(**attrs)
  File “d:softwaresetuppythonlibdistutilscore.py”, line 148, in setup
    dist.run_commands()
  File “d:softwaresetuppythonlibdistutilsdist.py”, line 966, in run_commands
    self.run_command(cmd)
  File “d:softwaresetuppythonlibdistutilsdist.py”, line 985, in run_command
    cmd_obj.run()
  File “C:UsersyaoqifaAppDataRoamingPythonPython37site-packagessetuptoolscommandinstall.py”, line 61, in run
    return orig.install.run(self)
  File “d:softwaresetuppythonlibdistutilscommandinstall.py”, line 545, in run
    self.run_command(‘build’)
  File “d:softwaresetuppythonlibdistutilscmd.py”, line 313, in run_command
    self.distribution.run_command(command)
  File “d:softwaresetuppythonlibdistutilsdist.py”, line 985, in run_command
    cmd_obj.run()
  File “d:softwaresetuppythonlibdistutilscommandbuild.py”, line 135, in run
    self.run_command(cmd_name)
  File “d:softwaresetuppythonlibdistutilscmd.py”, line 313, in run_command
    self.distribution.run_command(command)
  File “d:softwaresetuppythonlibdistutilsdist.py”, line 985, in run_command
    cmd_obj.run()
  File “C:UsersyaoqifaAppDataLocalTemppip-install-u6nbqcm2dlibsetup.py”, line 129, in run
    cmake_version = self.get_cmake_version()
  File “C:UsersyaoqifaAppDataLocalTemppip-install-u6nbqcm2dlibsetup.py”, line 125, in get_cmake_version
    “n*******************************************************************n”)
RuntimeError:
*******************************************************************
 CMake must be installed to build the following extensions: dlib
*******************************************************************

其实是缺少Cmake包和CBoot包,安装这两个包即可

python -m pip install CMake -i https://pypi.tuna.tsinghua.edu.cn/simple/
python -m pip install Boost -i https://pypi.tuna.tsinghua.edu.cn/simple/

安装之后再安装dlib即可

python -m pip install dlib -i https://pypi.tuna.tsinghua.edu.cn/simple/

在这里插入图片描述

python安装dlib库时报‘ERROR: CMake must be installed to build dlib’

使用python安装dlib库时,会遇到下面的错误:

这个提示表示你没有安装Cmake编译,所以需要先安装cmake:

pip install cmake

安装成功后,再次安装dlib即可。

pip install dlib

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持aitechtogether.com。

退出移动版