【pip】解决 pip install pandas 时 subprocess-exited-with-error 错误

文章目录

发现问题

使用 pip 安装 pandas==2.3.3 时遇到报错如下:

sh 复制代码
Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ...
  error: static assertion failed: "__has_builtin not detected; please try a newer compiler"
  ...
  ninja: build stopped: subcommand failed.
  ...
  This error originates from a subprocess, and is likely not a problem with pip.
  ...
  error: metadata-generation-failed
  ...
  Encountered error while generating package metadata.

解决问题

经过尝试,安装较低版本的 pandas 可以解决该问题。

首先查询当前环境支持安装哪些版本的 pandas:

sh 复制代码
python -m pip index versions pandas

输出如下

sh 复制代码
pandas (2.3.3)
Available versions: 2.3.3, 2.3.2, 2.3.1, 2.3.0, 2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.4, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.5.3, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.5, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.5, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.5, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 1.0.5, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.25.3, 0.25.2, 0.25.1, 0.25.0, 0.24.2, 0.24.1, 0.24.0, 0.23.4, 0.23.3, 0.23.2, 0.23.1, 0.23.0, 0.22.0, 0.21.1, 0.21.0, 0.20.3, 0.20.2, 0.20.1, 0.20.0, 0.19.2, 0.19.1, 0.19.0, 0.18.1, 0.18.0, 0.17.1, 0.17.0, 0.16.2, 0.16.1, 0.16.0, 0.15.2, 0.15.1, 0.15.0, 0.14.1, 0.14.0, 0.13.1, 0.13.0, 0.12.0, 0.11.0, 0.10.1, 0.10.0, 0.9.1, 0.9.0, 0.8.1, 0.8.0, 0.7.3, 0.7.2, 0.7.1, 0.7.0, 0.6.1, 0.6.0, 0.5.0, 0.4.3, 0.4.2, 0.4.1, 0.4.0, 0.3.0, 0.2, 0.1

由于 2.3.3 安装失败,就选择尝试安装 2.2.3 版本,安装成功

sh 复制代码
python -m pip install pandas==2.2.3

额外技巧

使用 python -m pip xxx 而不是 pip xxx 可以明确指定在当前 conda 等虚拟环境内操作,可以避免把 pip 包安装到默认环境中去等问题。

相关推荐
benchmark_cc1 天前
批量获取量化数据时,如何设置合理的超时和重试机制?——QuantDash 高性能实战指南
开发语言·人工智能·python·pandas·量化·quantdash
2601_966949651 天前
使用 Pandas 读取批量数据时如何避免内存溢出?QuantDash 量化数据工程师避坑指南
开发语言·python·pandas·tushare·akshare·quantdash
三十岁老牛再出发3 天前
08.18每日总结
c++·python·numpy·pandas
虎头金猫5 天前
如何在群晖NAS上通过Docker部署CloudSaver?群晖部署CloudSaver教程|聚合资源搜索并实现远程访问
运维·服务器·网络·python·docker·容器·pandas
skywalk81636 天前
pypi 的yank 是什么意思?
pip
Uncommon.7 天前
使用pandas处理csv并转为张量
pytorch·python·深度学习·pandas
STR_Liang9 天前
pandas.read_html 报错FileNotFoundError、OSError Traceback (most recent call last)
pandas
㳺三才人子10 天前
初探 Data Analysis - Matplotlib
python·plotly·pandas·matplotlib
quantdash_cc10 天前
告别自建 Requests/BS4 网页爬虫:基于 QuantDash 搭建零维保的高性能量化行情流水线
开发语言·爬虫·python·pandas·量化·quantdash
菜冻鱼10 天前
Python-sklearn-评估指标
开发语言·人工智能·python·机器学习·numpy·pandas·sklearn