{
  "id": "python/setuptools-command-error-build-ext",
  "signature": "error: command 'gcc' failed with exit code 1\n  ...\n  building 'mypkg._ext' extension\n  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare ...\n  mypkg/_ext.c:10:10: fatal error: Python.h: No such file or directory",
  "signature_zh": "错误：命令 'gcc' 以退出码 1 失败\n  ...\n  正在构建 'mypkg._ext' 扩展\n  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare ...\n  mypkg/_ext.c:10:10: 致命错误：Python.h: 没有那个文件或目录",
  "regex": "error:\\ command\\ 'gcc'\\ failed\\ with\\ exit\\ code\\ 1\\\n\\ \\ \\.\\.\\.\\\n\\ \\ building\\ 'mypkg\\._ext'\\ extension\\\n\\ \\ gcc\\ \\-pthread\\ \\-B\\ /opt/conda/compiler_compat\\ \\-Wl,\\-\\-sysroot=/\\ \\-Wsign\\-compare\\ \\.\\.\\.\\\n\\ \\ mypkg/_ext\\.c:10:10:\\ fatal\\ error:\\ Python\\.h:\\ No\\ such\\ file\\ or\\ directory",
  "domain": "python",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "The Python development headers (Python.h) are not installed, so setuptools cannot compile a C extension during the build step.",
  "root_cause_type": "generic",
  "root_cause_zh": "未安装 Python 开发头文件（Python.h），因此 setuptools 在构建步骤中无法编译 C 扩展。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The failure is a missing system header, not an outdated setuptools.",
      "fail_rate": 0.92,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not provide Python.h.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The header does not exist at that path without installing python3-dev.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "On Debian/Ubuntu: sudo apt-get install python3-dev; on RHEL: sudo dnf install python3-devel; then retry pip install.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Run pip install --only-binary=:all: mypkg to force wheel usage.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-27",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}