# 错误：'egg_info' 命令出错：'NoneType' 对象没有属性 'get'

- **ID:** `python/pip-egg-info-metadata-generation-failed`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

setup.cfg/pyproject.toml 段落格式错误或缺失，导致 setuptools 的元数据读取器在 egg_info 生成过程中收到 None 而非 dict。

## 版本兼容性

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

## 解决方案

1. **** (85% 成功率)
   ```
   Validate config: python -c "import configparser,sys; c=configparser.ConfigParser(); c.read('setup.cfg'); print(dict(c['metadata']))"
   ```
2. **** (90% 成功率)
   ```
   Move metadata into pyproject.toml's [project] table and remove the conflicting setup.cfg section
   ```
3. **** (80% 成功率)
   ```
   Run python setup.py egg_info -v to see the full traceback and locate the offending key
   ```

## 无效尝试

- **** — Isolation is not the cause; the malformed metadata file still breaks egg_info. (85% 失败率)
- **** — The stale directory is regenerated from the same malformed config, reproducing the error. (80% 失败率)
- **** — A newer setuptools may produce a clearer error but still cannot parse an invalid config. (70% 失败率)
