我尝试在 Windows 计算机上安装 pandas,但得到以下输出:
python -m pip install pandas
Collecting pandas
Using cached pandas-2.2.2.tar.gz (4.4 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
╰─> [13 lines of output]
+ meson setup C:\Users\serba\AppData\Local\Temp\pip-install-6cc_jg_i\pandas_90906587555b4b9d852626b7159094db C:\Users\serba\AppData\Local\Temp\pip-install-6cc_jg_i\pandas_90906587555b4b9d852626b7159094db\.mesonpy-6bapjes7\build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=C:\Users\serba\AppData\Local\Temp\pip-install-6cc_jg_i\pandas_90906587555b4b9d852626b7159094db\.mesonpy-6bapjes7\build\meson-python-native-file.ini
The Meson build system
Version: 1.2.1
Source dir: C:\Users\serba\AppData\Local\Temp\pip-install-6cc_jg_i\pandas_90906587555b4b9d852626b7159094db
Build dir: C:\Users\serba\AppData\Local\Temp\pip-install-6cc_jg_i\pandas_90906587555b4b9d852626b7159094db\.mesonpy-6bapjes7\build
Build type: native build
Project name: pandas
Project version: 2.2.2
Activating VS 15.9.60
..\..\meson.build:2:0: ERROR: Value "c11" (of type "string") for combo option "C language standard to use" is not one of the choices. Possible choices are (as string): "none", "c89", "c99", "gnu89", "gnu90", "gnu9x", "gnu99".
A full log can be found at C:\Users\serba\AppData\Local\Temp\pip-install-6cc_jg_i\pandas_90906587555b4b9d852626b7159094db\.mesonpy-6bapjes7\build\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.
我尝试了以下方法:
输出还是一样。
我看到它在抱怨 C 标准。我需要安装特定的编译器或任何其他先决条件吗?
谢谢。 问候, 塞尔维亚
所以我克服了这个问题,这是发生这种情况的一个愚蠢的原因。我在 MinGW 安装文件夹中的某个位置有另一个 pip 二进制文件,它总是调用该二进制文件。我确保更改环境变量以指向正确的、独立的 pip 安装(也不是 python)。