# 错误：无法为 cryptography 构建 wheel，而它是安装基于 pyproject.toml 的项目所必需的

- **ID:** `python/error-could-not-build-wheels-for-package`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

由于当前平台/Python ABI 没有匹配的 wheel，某个依赖必须从源码编译。当解释器比包的 wheel 矩阵更新，或在 musl/Alpine 上 manylinux wheel 不兼容时会发生。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |
| 3.13 | active | — | — |

## 解决方案

1. **** (80% 成功率)
   ```
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
pip install cryptography
   ```
2. **** (90% 成功率)
   ```
   FROM python:3.11-slim
RUN pip install cryptography
   ```
3. **** (70% 成功率)
   ```
   pip install 'cryptography<42'
   ```

## 无效尝试

- **** — Upgrading tools does not produce a wheel for an unsupported ABI; build still fails. (55% 失败率)
- **** — Cache is not the issue; the wheel simply does not exist for this platform. (80% 失败率)
- **** — Force reinstall re-triggers the same source build path. (85% 失败率)
