简体   繁体   English

python中face_recognition模块期间的未知错误

[英]Unknown error during face_recognition module in python

i am not able to install face_recognition module我无法安装 face_recognition 模块

whenever I try to install the face recognition module I get this unknown error, I have already updated the Cmake and pip to the latest version but still, this error shows.每当我尝试安装人脸识别模块时,我都会收到此未知错误,我已经将 Cmake 和 pip 更新到最新版本,但仍然显示此错误。 It's like:就像是:

subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\dlib\\build\\lib.win32-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\ashish\\appdata\\local\\programs\\python\\python37-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\dlib\\build\\lib.win32-3.7']' returned non-zero exit status 1. subprocess.CalledProcessError: 命令 '['cmake', 'C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Ashish\\AppData \\Local\\Temp\\pip-install-9szfcst7\\dlib\\build\\lib.win32-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\ashish\\appdata\\local\\programs\\python\\python37-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\dlib\\build\\lib.win32-3.7']' 返回非零退出状态 1。

----------------------------------------

Command "c:\\users\\ashish\\appdata\\local\\programs\\python\\python37-32\\python.exe -u -c "import setuptools, tokenize;命令 "c:\\users\\ashish\\appdata\\local\\programs\\python\\python37-32\\python.exe -u -c "import setuptools, tokenize; file ='C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\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 C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-record-psz1uqhy\\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\dlib\\ file ='C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-install-9szfcst7\\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 C:\\Users\\Ashish\\AppData \\Local\\Temp\\pip-record-psz1uqhy\\install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 C:\\Users\\Ashish\\AppData\\Local\\Temp\\pip-安装-9szfcst7\\dlib\\

workaround解决方法

Assuming you are using Anaconda3 (based on the screenshot) and since the dependency of face_recognition that need to be compiled is named dlib and is available on conda-forge , I suggest you try the following:假设您使用的是 Anaconda3(基于屏幕截图)并且由于需要编译的face_recognition的依赖项名为dlib并且在conda- dlib上可用,我建议您尝试以下操作:

(1) Open Annaconda terminal (1) 打开 Annaconda 终端

(2) Add conda forge channel (2) 添加conda forge通道

conda config --add channels conda-forge

(3) Create and activate a new environment (3) 创建和激活新环境

conda create -n my_experiments
conda activate my_experiments

(4) install dlib (4) 安装dlib

conda install dlib

(5) install other dependencies of face_recognition that are available on conda (5) 安装face_recognition上可用的face_recognition其他依赖

conda install click numpy pillow

(6) install the models. (6) 安装模型。 Since they are not available on conda, the following should do it:由于它们在 conda 上不可用,因此应执行以下操作:

pip install face_recognition_models

(7) Last, since face_recognition is only composed of python script but not available on conda, you can then try this: (7) 最后,由于face_recognition仅由 python 脚本组成,而在face_recognition上不可用,您可以尝试以下操作:

pip install face_recognition --no-deps

the proper fix正确的修复

Python wheels for both dlib and face_recognition should be made available.应提供用于dlibface_recognition Python 轮子。

A python wheel is package that contain python and also pre-compiled library code. python wheel 是包含 python 和预编译库代码的包。 This allows the user to easily install the package.这允许用户轻松安装包。

The latest release of dlib doesn't have any wheels available: https://pypi.org/project/dlib/19.15.0/#files最新版本的 dlib 没有任何可用的轮子: https ://pypi.org/project/dlib/19.15.0/#files

I will follow up and report an issue to the maintainer of dlib.我会跟进并向dlib的维护者报告问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM