ModuleNotFoundError: нет модуля с именем face_recognition - PullRequest
0 голосов
/ 14 марта 2019
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)

Когда я запускаю приведенный выше код, я обнаружил следующее сообщение об ошибке.

Traceback (последний вызов был последним): файл "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

Команда "/usr/local/opt/python/bin/python3.7 -u -c" import setuptools, токенизировать; файл = '/ частный / вар / папки / LJ / cyczw6r164b5f3q1dvmbbkfh0000gn / T / пип-установки-gk35rom0 / dlib / setup.py'; е = GetAttr (разбития, 'open', open) ( file ); code = f.read (). replace ('\ r \ n', '\ n'); f.close (); exec (скомпилировать (код, file , 'exec')) "install --record /private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-record-3enjhgfq/install-record.txt --single-version-внешне управляемый --compile "не удалось с кодом ошибки 1 в / Частный / вар / папки / LJ / cyczw6r164b5f3q1dvmbbkfh0000gn / T / пип-установки-gk35rom0 / dlib /

Моя версия на питоне Python 3.7.1 и пункт pip 19.0.3 from /Library/Python/2.7/site-packages/pip (python 2.7)

1 Ответ

1 голос
/ 14 марта 2019

Установите Cmake с:

sudo apt install cmake

А для python3 не используйте pip, используйте pip3 для установки будущих модулей python3:

pip3 install face_recognition

...