如何解决安装错误的问题

问题描述 投票:0回答:2
pip install pandas --pre  
  Using cached pandas-2.1.0.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:\TEMP\pip-install-z0_0skv2\pandas_0e513c02a1e4406d845be40ba34f7a2d C:\TEMP\pip-install-z0_0skv2\pandas_0e513c02a1e4406d845be40ba34f7a2d\.mesonpy-t_en0olc\build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=C:\TEMP\pip-install-z0_0skv2\pandas_0e513c02a1e4406d845be40ba34f7a2d\.mesonpy-t_en0olc\build\meson-python-native-file.ini 
      The Meson build system
      Version: 1.0.1
      Source dir: C:\TEMP\pip-install-z0_0skv2\pandas_0e513c02a1e4406d845be40ba34f7a2d
      Build dir: C:\TEMP\pip-install-z0_0skv2\pandas_0e513c02a1e4406d845be40ba34f7a2d\.mesonpy-t_en0olc\build
      Build type: native build
      Project name: pandas
      Project version: 2.1.0
     
      ..\..\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:\TEMP\pip-install-z0_0skv2\pandas_0e513c02a1e4406d845be40ba34f7a2d\.mesonpy-t_en0olc\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. py -m pip install --upgrade pip setuptools wheel
    .
  2. 添加
    --pre
  3. 重新下载

但这不是成功的方法。

python list installation pip runtime-error
2个回答
0
投票

我也有同样的问题。 Pandas 2.1.3 需要的 Python 版本至少为 3.9。请检查您的Python版本是否不低于该版本。我通过安装最新的Python版本解决了这个问题。

顺便说一句,您还需要安装新的Python版本并更新Python环境变量。例如,在环境变量中指定新Python版本的路径,例如C:\Python\Python312\和C:\Python\Python312\Scripts。之后,使用 python -V 检查设置是否正确。完成此操作后,pip install pandas 命令应该可以正常工作。


0
投票

我使用 Python 32 位遇到了这个错误,我通过下载 64 位版本的 Python 解决了它。

当您使用 pip 安装任何库时,pip 会检查该库的预编译版本,称为“轮子”。如果它找不到与您的硬件/操作系统和 Python 版本兼容的版本,它将尝试使用本地工具链构建所需的代码。

如果找不到工具链,就会出现此错误。

所以,有多种解决方案:

  • 尝试下载与您的系统架构(32位、64位、ARM64)匹配的另一个版本的Python(Pandas 2.1.3高于3.9)。确保使用命令
    python --version
  • 使用正确的 python 版本
  • 使用 Anaconda,它使用预先打包的 Pandas 代码 (repo.anaconda.com)。
  • 安装 C/C++ 工具链(例如 Microsoft Visual Studio)。您可能需要在 pip 配置中指定编译器位置。
© www.soinside.com 2019 - 2024. All rights reserved.