pip安装ast时出现subprocess-exited-with-error错误如何解决?
解决pip install ast时的subprocess-exited-with-error错误
核心问题
ast是Python内置的标准库,完全不需要通过pip install命令安装。你执行该命令时,pip实际尝试安装的是一个第三方的、版本为0.0.2的非官方AST包,这个包存在构建缺陷,才导致你遇到构建wheel的错误。
错误信息
Downloading AST-0.0.2.tar.gz (19 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error
note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
已尝试操作
- 安装visual code installer
- 安装C++编译器
- 通过Conda Prompt安装
- 通过管理员终端安装
- 通过C++ VS Code安装
- 遵循ast官方文档操作
解决方案
- 直接在Python代码中导入使用:
import ast,无需任何额外安装步骤 - 若已误安装第三方AST包,执行
pip uninstall ast彻底移除
内容的提问来源于stack exchange,提问作者user20759768
相关产品推荐
相关产品推荐

