# 错误：无法为 somepkg 构建 wheel，这是安装基于 pyproject.toml 的项目所必需的
  错误：子进程退出并报错
  × 为 somepkg（pyproject.toml）构建 wheel 未成功运行。
  │ 退出码：1
  ╰─> [12 行输出]
      gcc: 错误：无法识别的命令行选项 '-mavx2'

- **ID:** `python/pip-wheel-not-supported-platform`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

目标平台/Python 组合没有预构建 wheel，pip 回退到从源码构建，而本地工具链（gcc/clang）不支持所需标志或缺少头文件。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   Install build deps: apt-get install -y build-essential python3-dev (or xcode-select --install on macOS)
   ```
2. **** (80% 成功率)
   ```
   Upgrade the compiler: on macOS 'brew install gcc' and set CC=gcc-13; on Linux use a newer distro or toolchain
   ```
3. **** (75% 成功率)
   ```
   Use a prebuilt manylinux wheel from a different index: pip install --only-binary=:all: --extra-index-url https://download.pytorch.org/whl/cpu somepkg
   ```

## 无效尝试

- **** — Forces source builds for everything, making the failure more likely and slower. (90% 失败率)
- **** — Disables isolation but the compiler still lacks the required flags/headers. (85% 失败率)
- **** — The build failure is deterministic; retries produce the same compiler error. (95% 失败率)
