python install_error ai_generated true

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

ID: python/setuptools-command-not-found

Also available as: JSON · Markdown · 中文
80%Fix Rate
90%Confidence
0Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.10 active

Root Cause

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

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 100% fail

    Still fails because the compiler doesn't exist.

  2. 70% fail

    Skips isolation but still needs a compiler.

  3. 60% fail

    Headers are not enough; compiler binary is required.