解决Python pip报错:解析pyproject.toml文件时出错

环境:win11(Python 3.9.13)
原因:想安装低版本python,结果安装成了32位的,但是依赖包基本都是64位的。
解决办法:重装64位python(可能还需要Visual Studio内安装“使用C++的桌面开发”)

异常报错:

Collecting matplotlib~=3.0 (from gradio)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/df/17/1747b4154034befd0ed33b52538f5eb7752d05bb51c5e2a31470c3bc7d52/matplotlib-3.9.4.tar.gz (36.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
+ meson setup C:\Users\gys\AppData\Local\Temp\pip-install-qzy88ud1\matplotlib_a18da0e9bc1e4bfaa27c95c0c41ab3ef C:\Users\gys\AppData\Local\Temp\pip-install-qzy88ud1\matplotlib_a18da0e9bc1e4bfaa27c95c0c41ab3ef.mesonpy-g0w8_shb -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\gys\AppData\Local\Temp\pip-install-qzy88ud1\matplotlib_a18da0e9bc1e4bfaa27c95c0c41ab3ef.mesonpy-g0w8_shb\meson-python-native-file.ini
The Meson build system
Version: 1.7.0
Source dir: C:\Users\gys\AppData\Local\Temp\pip-install-qzy88ud1\matplotlib_a18da0e9bc1e4bfaa27c95c0c41ab3ef
Build dir: C:\Users\gys\AppData\Local\Temp\pip-install-qzy88ud1\matplotlib_a18da0e9bc1e4bfaa27c95c0c41ab3ef.mesonpy-g0w8_shb
Build type: native build
Program python3 found: YES
Project name: matplotlib
Project version: 3.9.4
WARNING: Failed to activate VS environment: Could not parse vswhere.exe output

  ..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
  The following exception(s) were encountered:
  Running `icl ""` gave "[WinError 2] 系统找不到指定的文件。"
  Running `cl /?` gave "[WinError 2] 系统找不到指定的文件。"
  Running `cc --version` gave "[WinError 2] 系统找不到指定的文件。"
  Running `gcc --version` gave "[WinError 2] 系统找不到指定的文件。"
  Running `clang --version` gave "[WinError 2] 系统找不到指定的文件。"
  Running `clang-cl /?` gave "[WinError 2] 系统找不到指定的文件。"
  Running `pgcc --version` gave "[WinError 2] 系统找不到指定的文件。"

  A full log can be found at C:\Users\gys\AppData\Local\Temp\pip-install-qzy88ud1\matplotlib_a18da0e9bc1e4bfaa27c95c0c41ab3ef\.mesonpy-g0w8_shb\meson-logs\meson-log.txt
  [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

作者:我有一个魔盒

物联沃分享整理
物联沃-IOTWORD物联网 » 解决Python pip报错:解析pyproject.toml文件时出错

发表回复