# 错误：无效的需求：'package==1.0 ; extra == "test"' - 在额外说明符之后预期字符串结束

- **ID:** `pip/requirements-file-syntax-error-extra`
- **领域:** pip
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

requirements.txt 中的 extras 语法格式错误：pip 期望 extras 条件是一个简单的标记表达式，无需引用 extra 名称，或者 extra 名称必须匹配有效的 PEP 508 标记。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 19.0+ | active | — | — |
| Python 3.6-3.12 | active | — | — |

## 解决方案

1. ```
   Use the correct PEP 508 marker syntax: package==1.0; extra == "test" (no space before semicolon, extra value in double quotes). Example:
package==1.0; extra == "test"
   ```
2. ```
   Use a separate requirements file for extras: create requirements-test.txt with just package==1.0 and install with pip install -r requirements-test.txt
   ```

## 无效尝试

- **** — The quotes are interpreted as part of the package name or marker, causing a different parse error. (90% 失败率)
- **** — Pip expects the marker value to be a string literal in quotes, e.g., extra == "test", not an unquoted identifier. (75% 失败率)
- **** — Pip does not support comma-separated extras in requirements.txt; it's invalid syntax. (85% 失败率)
