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

Windows11+Python3.11安装Pandas/Streamlit遇Preparing metadata错误

解决Pandas/Streamlit安装时Meson解析vswhere.exe输出失败的问题

环境信息

  • Python版本:3.11.0
  • 操作系统:Windows 11
  • 报错触发:执行pip install pandas streamlit时,卡在Preparing metadata (pyproject.toml)步骤,核心错误为Meson构建系统无法解析vswhere.exe输出

完整错误日志

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\user\AppData\Local\Temp\pip-install-pp_1gho0\pandas_c428c00413ef4d5aa6d90953699360e4 C:\Users\user\AppData\Local\Temp\pip-install-pp_1gho0\pandas_c428c00413ef4d5aa6d90953699360e4\.mesonpy-xvkbs22n\build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=C:\Users\user\AppData\Local\Temp\pip-install-pp_1gho0\pandas_c428c00413ef4d5aa6d90953699360e4\.mesonpy-xvkbs22n\build\meson-python-native-file.ini
      The Meson build system
      Version: 1.2.1
      Source dir: C:\Users\user\AppData\Local\Temp\pip-install-pp_1gho0\pandas_c428c00413ef4d5aa6d90953699360e4
      Build dir: C:\Users\user\AppData\Local\Temp\pip-install-pp_1gho0\pandas_c428c00413ef4d5aa6d90953699360e4\.mesonpy-xvkbs22n\build
      Build type: native build
      Project name: pandas
      Project version: 2.2.2

      ..\..\meson.build:2:0: ERROR: Could not parse vswhere.exe output

      A full log can be found at C:\Users\user\AppData\Local\Temp\pip-install-pp_1gho0\pandas_c428c00413ef4d5aa6d90953699360e4\.mesonpy-xvkbs22n\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.

解决方法

1. 检查/修复Visual Studio编译环境

vswhere.exe是Visual Studio的配套工具,Meson依赖它定位编译组件:

  • 打开Visual Studio Installer,确认已安装**"Desktop development with C++"**工作负载(需包含MSVC编译器、Windows SDK)
  • 若已安装,选择"更多"->"修复",修复VS安装文件

2. 用VS原生命令行执行安装

绕开vswhere.exe的解析问题,直接使用配置好的编译环境:

  • 打开Visual Studio的"x64 Native Tools Command Prompt"(32位系统选x86版本)
  • 在该窗口中执行:pip install pandas streamlit

3. 降级Meson版本

当前Meson 1.2.1存在兼容性问题,降级到稳定版本:

pip install meson==1.1.1

之后再执行原安装命令

4. 安装预编译wheel包

避免源码编译,直接用预编译二进制包:

  • 安装wheel工具:pip install wheel
  • 下载对应Python3.11、Windows平台的pandas和streamlit wheel包(文件名含cp311和win_amd64)
  • 本地安装:pip install pandas-xxxx-cp311-win_amd64.whl streamlit-xxxx-cp311-win_amd64.whl

5. 检查PATH环境变量

确保vswhere.exe路径加入系统PATH:

  • vswhere.exe默认路径:C:\Program Files (x86)\Microsoft Visual Studio\Installer
  • 若该路径不在系统PATH中,添加后重启终端再尝试安装

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 00:31:14