You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在PyCharm中无法安装pandas包的问题求助

解决方案:pip安装pandas时找不到vswhere.exe的问题

问题原因

pandas 2.1.1采用Meson构建系统编译,在Windows环境下,Meson依赖vswhere.exe来定位Visual Studio的C++编译工具链。当系统缺少Visual Studio相关组件,或者vswhere.exe未被加入环境变量时,就会触发该报错。

解决方法

方法一:直接安装预编译包(最快)

跳过源码编译环节,强制pip使用预编译的wheel包,执行以下命令:

pip install pandas --only-binary :all:

方法二:修复vswhere缺失问题(适合后续编译其他依赖C扩展的包)

  • 安装Visual Studio Build Tools:下载并安装Visual Studio Build Tools,勾选「Desktop development with C++」组件,安装完成后会自动配置vswhere.exe及相关编译工具。
  • 手动配置环境变量:若已安装但仍报错,找到vswhere.exe的路径(通常在C:\Program Files (x86)\Microsoft Visual Studio\Installer\),将该路径添加到系统PATH环境变量中,重启终端或PyCharm后重试。
  • 验证配置:打开终端执行vswhere.exe,若能输出Visual Studio相关信息,说明配置成功。

附用户报错详情

(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-wxwl0axi\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-file.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.

内容的提问来源于stack exchange,提问作者user21520585

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 22:30:32