# mypkg setup 命令出错：'classifiers' 必须是字符串列表，得到：'Programming Language :: Python :: 3.11'

- **ID:** `python/setuptools-invalid-classifier`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

将单个分类器字符串赋值给 classifiers，而不是列表；或在 setup.cfg/pyproject.toml 中使用了逗号分隔的字符串。

## 版本兼容性

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

## 解决方案

1. **** (98% 成功率)
   ```
   # setup.cfg
[metadata]
classifiers =
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.11

# pyproject.toml
classifiers = [
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3.11",
]
   ```
2. **** (92% 成功率)
   ```
   python -m pip install trove-classifiers
python - <<'PY'
from trove_classifiers import classifiers
for c in ["Programming Language :: Python :: 3.11"]:
    assert c in classifiers, c
print('ok')
PY
   ```

## 无效尝试

- **** — Produces one bogus classifier containing commas instead of three valid ones. (85% 失败率)
- **** — Loses PyPI metadata used for search and compatibility filtering. (60% 失败率)
