Ubuntu20.04 Python3安装dlib报错

in 默认分类 with 0 comment

使用pip install dlib时,报错

Downloading dlib-19.23.0.tar.gz (3.2 MB)
     |████████████████████████████████| 3.2 MB 3.4 MB/s 
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iz5ce8wa/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iz5ce8wa/dlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-m3c6qin4
       cwd: /tmp/pip-install-iz5ce8wa/dlib/
  Complete output (8 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'tools/python/dlib/__init__.py' not found (or not a regular file)
  running build_ext
  
  ERROR: CMake must be installed to build dlib
  
  ----------------------------------------
  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: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iz5ce8wa/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iz5ce8wa/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 /tmp/pip-record-m45blc17/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/xxx/.local/include/python3.8/dlib
         cwd: /tmp/pip-install-iz5ce8wa/dlib/
    Complete output (8 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
    
    ERROR: CMake must be installed to build dlib
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iz5ce8wa/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iz5ce8wa/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 /tmp/pip-record-m45blc17/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/xxx/.local/include/python3.8/dlib Check the logs for full command output.

解决办法,安装cmake

sudo apt install cmake

Responses