ModuleNotFoundError: No module named 'face_recognition'
ModuleNotFoundError: No module named '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)
当我 运行 以上代码时,我发现了以下错误消息。
Traceback (most recent call last): File "sample.py", line 1, in
import 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
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools,
tokenize;file='/private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-install-gk35rom0/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 /private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-record-3enjhgfq/install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
/private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-install-gk35rom0/dlib/
我的 python 版本是 Python 3.7.1
并且 pip 是 pip 19.0.3 from /Library/Python/2.7/site-packages/pip (python 2.7)
安装 Cmake:
sudo apt install cmake
并且 python3 不要单独使用 pip
,使用 pip3
安装未来的 python3 模块:
pip3 install face_recognition
我遇到了同样的问题,但后来通过以下步骤解决了:
第 1 步:下载 Microsoft Visual Studio 2015 或更新版本(检查构建工具是否足够)。
第 2 步:下载 cmake(pip 安装 cmake)
第 3 步:安装 dlib(pip 安装 dlib)
第四步:安装人脸识别(pip install face-recognition)
但是安装在特定的环境中,稍后将用于face_recognition代码(在conda中:激活环境名称)。
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 (most recent call last): File "sample.py", line 1, in import 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
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-install-gk35rom0/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 /private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-record-3enjhgfq/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-install-gk35rom0/dlib/
我的 python 版本是 Python 3.7.1
并且 pip 是 pip 19.0.3 from /Library/Python/2.7/site-packages/pip (python 2.7)
安装 Cmake:
sudo apt install cmake
并且 python3 不要单独使用 pip
,使用 pip3
安装未来的 python3 模块:
pip3 install face_recognition
我遇到了同样的问题,但后来通过以下步骤解决了:
第 1 步:下载 Microsoft Visual Studio 2015 或更新版本(检查构建工具是否足够)。
第 2 步:下载 cmake(pip 安装 cmake)
第 3 步:安装 dlib(pip 安装 dlib)
第四步:安装人脸识别(pip install face-recognition)
但是安装在特定的环境中,稍后将用于face_recognition代码(在conda中:激活环境名称)。