# 错误：'name' 必须在 pyproject.toml 或 setup.py 中提供，但两者都存在且值不同

- **ID:** `python/setuptools-pyproject-and-setup-conflict`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

项目同时包含 pyproject.toml [project] 和 setup.py，且元数据冲突。setuptools 不会合并它们；TOML 优先，但不一致会触发错误。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   from setuptools import setup; setup()  # metadata in pyproject.toml
   ```
2. **** (90% 成功率)
   ```
   [project]\ndynamic = ["version"]\n[tool.setuptools.dynamic]\nversion = {attr = "mypkg.__version__"}
   ```

## 无效尝试

- **** — Build isolation does not resolve metadata conflicts. (90% 失败率)
- **** — If setup.py contains custom commands or dynamic fields, deleting it breaks the build. (50% 失败率)
