python
system_error
ai_generated
true
错误:命令 'gcc' 失败:没有那个文件或目录 × 为 lxml 构建 wheel(pyproject.toml)未能成功运行。 │ 退出代码:1 ╰─> 错误:命令 'gcc' 失败,退出状态 1
error: command 'gcc' failed: No such file or directory × Building wheel for lxml (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> error: command 'gcc' failed with exit status 1
ID: python/setuptools-native-ext-build-failure
80%修复率
87%置信度
0证据数
2024-03-08首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
未安装 C 编译器(gcc/clang),因此 pip 回退到从源码构建 C 扩展并立即失败。
English
No C compiler (gcc/clang) is installed, so pip falls back to building a C extension from source and fails immediately.
解决方案
-
92% 成功率
# Debian/Ubuntu sudo apt install build-essential python3-dev libxml2-dev libxslt1-dev # macOS xcode-select --install # then python -m pip install lxml
-
90% 成功率
python -m pip install --only-binary=:all: lxml # or pin a version that ships wheels for your platform python -m pip install 'lxml==5.2.2'
无效尝试
常见但无效的做法:
-
85% 失败
Build tools are fine; the missing piece is the system C compiler.
-
90% 失败
Still attempts the source build and hits the same gcc error.