赞
踩
在电脑上安装Microsoft C++ 生成工具
https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
安装后,重新执行一下pip的安装命令即可
pip install face_recognition
(Runtool) PS F:\xgs\Python\project\RunTool\face_diff> pip install face_recognition Collecting face_recognition Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB) Collecting face-recognition-models>=0.3.0 (from face_recognition) Downloading face_recognition_models-0.3.0.tar.gz (100.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.1/100.1 MB 2.5 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Collecting Click>=6.0 (from face_recognition) Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB) Collecting dlib>=19.7 (from face_recognition) Downloading dlib-19.24.2.tar.gz (11.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.8/11.8 MB 2.7 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy (from face_recognition) Using cached numpy-1.26.3-cp39-cp39-win_amd64.whl.metadata (61 kB) Collecting Pillow (from face_recognition) Using cached pillow-10.2.0-cp39-cp39-win_amd64.whl.metadata (9.9 kB) Collecting colorama (from Click>=6.0->face_recognition) Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB) Using cached click-8.1.7-py3-none-any.whl (97 kB) Using cached numpy-1.26.3-cp39-cp39-win_amd64.whl (15.8 MB) Using cached pillow-10.2.0-cp39-cp39-win_amd64.whl (2.6 MB) Building wheels for collected packages: dlib, face-recognition-models Building wheel for dlib (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for dlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [73 lines of output] running bdist_wheel running build running build_ext <string>:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. Building extension for Python 3.9.18 (main, Sep 11 2023, 14:09:26) [MSC v.1916 64 bit (AMD64)] Invoking CMake setup: 'cmake C:\Users\xgs87762\AppData\Local\Temp\pip-install-b0plqkrh\dlib_0de19efb45b64f6ab87b725dfaeef405\tools\python -DCMAKE_LIBRARY_OUTPUT_DI RECTORY=C:\Users\xgs87762\AppData\Local\Temp\pip-install-b0plqkrh\dlib_0de19efb45b64f6ab87b725dfaeef405\build\lib.win-amd64-cpython-39 -DPYTHON_EXECUTABLE=D:\win\anacond a3\envs\Runtool\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\xgs87762\AppData\Local\Temp\pip-install-b0plqkrh\dlib_0de19efb45b64f6ab87b725dfaeef405\build \lib.win-amd64-cpython-39 -A x64' -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:5 (message): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! You must use Visual Studio to build a python extension on windows. If you are getting this error it means you have not installed Visual C++. Note that there are many flavors of Visual Studio, like Visual Studio for C# development. You need to install Visual Studio for C++. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "D:\win\anaconda3\envs\Runtool\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module> main() File "D:\win\anaconda3\envs\Runtool\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "D:\win\anaconda3\envs\Runtool\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in build_wheel return self._build_with_temp_dir( File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\build_meta.py", line 389, in _build_with_temp_dir self.run_setup() File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 218, in <module> File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup return distutils.core.setup(**attrs) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup return run_commands(dist) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command super().run_command(command) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run self.run_command("build") File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command super().run_command(command) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command super().run_command(command) File "C:\Users\xgs87762\AppData\Local\Temp\pip-build-env-dphgrhha\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "<string>", line 130, in run File "<string>", line 167, in build_extension File "D:\win\anaconda3\envs\Runtool\lib\subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\xgs87762\\AppData\\Local\\Temp\\pip-install-b0plqkrh\\dlib_0de19efb45b64f6ab87b725dfaeef405\\tools\\p ython', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\xgs87762\\AppData\\Local\\Temp\\pip-install-b0plqkrh\\dlib_0de19efb45b64f6ab87b725dfaeef405\\build\\lib.win-amd64-cp ython-39', '-DPYTHON_EXECUTABLE=D:\\win\\anaconda3\\envs\\Runtool\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\xgs87762\\AppData\\Local\\Temp\\pip- [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Building wheel for face-recognition-models (setup.py) ... done Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566184 sha256=4a0d3eed4c3f486ac46f04926568b8fe251b6a65ce 5f20bd2caeb3d5af449d46 Stored in directory: c:\users\xgs87762\appdata\local\pip\cache\wheels\22\a8\60\4a2aeb763d63f50190f4c4e07069a22245347eeafdb3a67551 Successfully built face-recognition-models Failed to build dlib ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects
参考链接:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。