安装face_recognition库时出错

时间:2018-03-19 14:42:16

标签: python-3.x cmake anaconda

如何在安装face_recognition库时解决下面提到的cmake错误?

Collecting face_recognition
  Using cached face_recognition-1.2.1-py2.py3-none-any.whl
Requirement already satisfied: face-recognition-models>=0.3.0 in ./anaconda/lib/python3.6/site-packages (from face_recognition)
Requirement already satisfied: Pillow in ./anaconda/lib/python3.6/site-packages (from face_recognition)
Requirement already satisfied: Click>=6.0 in ./anaconda/lib/python3.6/site-packages (from face_recognition)
Requirement already satisfied: scipy>=0.17.0 in ./anaconda/lib/python3.6/site-packages (from face_recognition)
Collecting dlib>=19.7 (from face_recognition)
  Using cached dlib-19.10.0.tar.gz
Requirement already satisfied: numpy in ./anaconda/lib/python3.6/site-packages (from face_recognition)
Requirement already satisfied: olefile in ./anaconda/lib/python3.6/site-packages (from Pillow->face_recognition)
Building wheels for collected packages: dlib
  Running setup.py bdist_wheel for dlib ... error
  Complete output from command /Users/muralidharan/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/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 /var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/tmpw6lzrrukpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  package init file 'dlib/__init__.py' not found (or not a regular file)
  running build_ext
  Invoking CMake setup: 'cmake /private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/dlib/build/lib.macosx-10.7-x86_64-3.6 -DPYTHON_EXECUTABLE=/Users/muralidharan/anaconda/bin/python -DCMAKE_BUILD_TYPE=Release'
  error: [Errno 2] No such file or directory: 'cmake'

  ----------------------------------------
  Failed building wheel for dlib
  Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib, face-recognition
  Running setup.py install for dlib ... error
    Complete output from command /Users/muralidharan/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/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 /var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-qhc3clwr-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    package init file 'dlib/__init__.py' not found (or not a regular file)
    running build_ext
    Invoking CMake setup: 'cmake /private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/dlib/build/lib.macosx-10.7-x86_64-3.6 -DPYTHON_EXECUTABLE=/Users/muralidharan/anaconda/bin/python -DCMAKE_BUILD_TYPE=Release'
    error: [Errno 2] No such file or directory: 'cmake'

    ----------------------------------------
Command "/Users/muralidharan/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/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 /var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-qhc3clwr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/xz/rcv9f_6x41gcvhrqzsd6mrxw0000gn/T/pip-build-5zqyoigf/dlib/ 

2 个答案:

答案 0 :(得分:0)

对于我,我在ubuntu16 python2.7中安装了face_recognition,我编写了一个shell来安装它。

#!/bin/bash
# This shell script install face_recognition in ubuntu16 python2.7

apt-get -y install git
apt-get -y install cmake
# install dlib without cuda
git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build; cd build; cmake .. ; cmake --build .

# install dlib python interface
cd -
apt-get -y install python-setuptools

apt-get -y install python-dev
python setup.py install

# install face_recognition
apt-get -y install python-pip
pip install face_recognition

答案 1 :(得分:0)

error: [Errno 2] No such file or directory: 'cmake'

我最近遇到了同样的问题,我下载了 CMAKE 解决了。

outputs an array by default