python install_error ai_generated true

错误:命令'gcc'失败:没有那个文件或目录

error: command 'gcc' failed: No such file or directory

ID: python/setuptools-command-not-found

其他格式: JSON · Markdown 中文 · English
80%修复率
90%置信度
0证据数
2024-01-20首次发现

版本兼容性

版本状态引入弃用备注
3.10 active

根因分析

当构建带有C扩展的Python包时,setuptools尝试调用C编译器,但gcc未安装或不在PATH中。

English

When building a Python package with C extensions, setuptools tries to invoke the C compiler, but gcc is not installed or not in PATH.

generic

解决方案

  1. 95% 成功率
    apt-get install build-essential (Debian/Ubuntu) or yum install gcc (RHEL)
  2. 80% 成功率
    pip install --only-binary :all: package
  3. 70% 成功率
    export CC='clang' if clang is available

无效尝试

常见但无效的做法:

  1. 100% 失败

    Still fails because the compiler doesn't exist.

  2. 70% 失败

    Skips isolation but still needs a compiler.

  3. 60% 失败

    Headers are not enough; compiler binary is required.