# 错误：pyproject.toml 配置无效：`project`。配置错误：`project.version` 必须是字符串，实际为 `float`。

- **ID:** `python/pip-install-invalid-pyproject-toml`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

TOML 将 `version = 1.0` 解析为浮点数，但 PEP 621 要求 version 字段为字符串。

## 版本兼容性

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

## 解决方案

1. **** (97% 成功率)
   ```
   Quote the version in pyproject.toml: `version = "1.0"` (or use dynamic version via setuptools_scm).
   ```
2. **** (94% 成功率)
   ```
   Validate before building: `python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])"`.
   ```

## 无效尝试

- **** — The pyproject.toml validation happens before build isolation settings matter. (90% 失败率)
- **** — Newer setuptools enforces the same PEP 621 type rules; the error persists. (85% 失败率)
