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)
当我运行上面的代码时,我发现了下面的错误消息。
追溯(最近一次调用):文件"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“导入setuptools,open)(file);code=f.read().replace('\r\n',‘'\n');f.close();(编译(代码,文件,'exec'))“安装-记录/private/var/folders/lj/cyczw6r164b5f3q1dvmbbkfh0000gn/T/pip-install-gk35rom0/dlib/ -单版本-外部管理-编译”失败,错误代码1在/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)
。
发布于 2019-03-14 03:24:11
用以下方式安装Cmake:
sudo apt install cmake
对于python3 --不只是使用pip
--使用pip3
安装未来的python3模块:
pip3 install face_recognition
发布于 2020-04-10 14:28:16
我也面临着同样的问题,但通过以下步骤解决了这个问题:
步骤1:下载2015或更高版本(检查构建工具是否足够)。
步骤2:下载cmake (pip安装cmake)
步骤3:安装dlib (pip Install )
第四步:安装人脸识别(pip安装面部识别)
但是,将它安装在特定的环境中,稍后将用于face_recognition代码(在conda: activate环境名称中)。
发布于 2022-08-16 14:48:57
对于在安装此步骤时仍然发现错误的每个人,我将为您的系统提供一个简短的要求。
接下来,在满足上述要求之后,执行以下操作。
另外,在我的例子中,我的枕头库出错了,所以您需要使用以下步骤重新安装它。
希望这能帮上忙谢谢。
https://stackoverflow.com/questions/55154397
复制相似问题