python system_error ai_generated true

error: Setup script exited with error: command 'gcc' failed: No such file or directory

ID: python/setuptools-command-not-found-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-02-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active
3.10 active

Root Cause

A Python package with C extensions requires a C compiler (like gcc) which is not installed on the system.

generic

中文

具有 C 扩展的 Python 包需要 C 编译器(如 gcc),但系统上未安装。

Workarounds

  1. 90% success Install C compiler and Python development headers
    On Ubuntu/Debian: `sudo apt-get install build-essential python3-dev`. On CentOS/RHEL: `sudo yum install gcc python3-devel`
  2. 75% success Use a pre-built wheel if available
    `pip install --only-binary=:all: <package_name>` or find a wheel from PyPI or an alternative index.

Dead Ends

Common approaches that don't work:

  1. Installing gcc but not the required development headers (python3-dev) 60% fail

    Without Python headers, gcc cannot find necessary include files like Python.h

  2. Using `pip install --no-build-isolation` alone 80% fail

    This flag only disables build isolation, but gcc is still needed for compilation.