python system_error ai_generated true

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

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

ID: python/setuptools-cython-build-error-missing-compiler

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2025-05-30首次发现

版本兼容性

版本状态引入弃用备注
3.7 active — — —
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —

根因分析

构建带有 C 扩展的包需要 C 编译器(gcc),但未安装或不在 PATH 中。这在没有 Visual Studio Build Tools 的 Windows 或最小化 Linux 安装中很常见。

English

Building a package with C extensions requires a C compiler (gcc), which is not installed or not in PATH. This is common on Windows without Visual Studio Build Tools or on minimal Linux installations.

generic

解决方案

  1. 95% 成功率
    On Linux: sudo apt-get install build-essential. On macOS: xcode-select --install. On Windows: install Microsoft Visual C++ Build Tools.
  2. 85% 成功率
    Use conda to install the package, which provides pre-built binaries: conda install <package>.

无效尝试

常见但无效的做法:

  1. 60% 失败

    If no wheel is available for the platform, pip falls back to source build and fails again.

  2. 90% 失败

    Clang is not installed, so the command still fails.