ModuleNotFoundError:没有名为“face_recognition”的模块

PPS*_*ein 6 python pip face-recognition

import face_recognition

image = face_recognition.load_image_file("My_Image.png")
face_locations = face_recognition.face_locations(image)
print("I found {} face(s) in this photograph.".format(len(face_locations)
Run Code Online (Sandbox Code Playgroud)

当我运行上面的代码时,我发现以下错误消息。

回溯(最近一次调用最后一次):文件“sample.py”,第 1 行,导入face_recognition

我检查过在安装库时是否发现了以下错误消息face_recognition

pip install face_recognition

  RuntimeError:
  *******************************************************************
   CMake must be installed to build the following extensions: dlib
  *******************************************************************


  ----------------------------------------
  Failed building wheel for dlib
  Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib, Pillow, numpy, face-recognition-models, face-recognition
Run Code Online (Sandbox Code Playgroud)

命令“/usr/local/opt/python/bin/python3.7 -u -c”导入setuptools,标记化;文件='/private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-install-gk35rom0/dlib/setup.py';f=getattr(tokenize,'open',打开)(文件);code=f.read ().replace('\r\n', '\n');f.close();exec(compile(code, file , 'exec'))" install --record /private/var/folders/lj /cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-record-3enjhgfq/install-record.txt --single-version-externally-management --compile" 在 /private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip- 中失败,错误代码为 1安装-gk35rom0/dlib/

我的 python 版本是Python 3.7.1pip 是pip 19.0.3 from /Library/Python/2.7/site-packages/pip (python 2.7)

GKE*_*GKE 8

安装 Cmake:

sudo apt install cmake

对于 python3 不要pip单独使用,用于pip3安装未来的 python3 模块:

pip3 install face_recognition