我在 Pycharm 上安装 pandas 包时遇到问题
我收到以下错误
`(venv) PS C:\Users\merta\PycharmProjects\pythonProject2> pip install pandas
Collecting pandas
Using cached pandas-2.1.1.tar.gz (4.3 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
╰─> [12 lines of output]
+ meson setup C:\Users\merta\AppData\Local\Temp\pip-install-d6d90p2m\pandas_68ffe712dae546f491bf76344985b59e C:\Users\merta\AppData\Local\Temp\pip-install-d6d90p2m\pandas_68ffe712dae546f491bf76344985b59e\.mesonpy-wxwl0ax
i\build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=C:\Users\merta\AppData\Local\Temp\pip-install-d6d90p2m\pandas_68ffe712dae546f491bf76344985b59e\.mesonpy-wxwl0axi\build\meson-python-native-fil
e.ini
The Meson build system
Version: 1.2.1
Source dir: C:\Users\merta\AppData\Local\Temp\pip-install-d6d90p2m\pandas_68ffe712dae546f491bf76344985b59e
Build dir: C:\Users\merta\AppData\Local\Temp\pip-install-d6d90p2m\pandas_68ffe712dae546f491bf76344985b59e\.mesonpy-wxwl0axi\build
Build type: native build
Project name: pandas
Project version: 2.1.1
..\..\meson.build:2:0: ERROR: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
A full log can be found at C:\Users\merta\AppData\Local\Temp\pip-install-d6d90p2m\pandas_68ffe712dae546f491bf76344985b59e\.mesonpy-wxwl0axi\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.
× 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.`
我尝试更改解释器,通过终端和pycharm选项安装pandas,但它不起作用
我不明白与 vswhere 的链接
谢谢您的帮助
您遇到的错误似乎与使用 Meson(一个构建系统)构建 Pandas 包的问题有关。它似乎试图从 Microsoft Visual Studio 中查找名为 vswhere.exe 的工具,但找不到它。这可能是由于 Visual Studio 安装不完整或不正确或配置错误造成的。
解决这个问题
安装 Visual Studio
升级 Pip 和设置工具
python -m pip install --upgrade
pip python -m pip install --升级安装工具
使用虚拟环境
python -m venv myenv
.\myenv\Scripts\激活
使用预建
pip安装pandas==2.1.1
如果不使用此工作
conda 安装 pandas