# 错误：无效的需求：'requests >=2.0 <3.0'（来自 requirements.txt 第 4 行）
提示：= 不是有效的运算符。您是指 == 吗？

- **ID:** `python/pip-requirement-parse-error`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

需求行的版本说明符格式错误，通常是使用了单个 `=` 而非 `==`，或运算符之间有空格。

## 版本兼容性

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

## 解决方案

1. **** (98% 成功率)
   ```
   Change `requests >=2.0 <3.0` to `requests>=2.0,<3.0`
   ```
2. **** (90% 成功率)
   ```
   python -c "from packaging.requirements import Requirement; [Requirement(l.strip()) for l in open('requirements.txt') if l.strip() and not l.startswith('#')]"
   ```

## 无效尝试

- **** — requirements.txt is parsed by pip, not the shell; quoting does not change the grammar. (90% 失败率)
- **** — The parser is strict by design; upgrading does not accept invalid syntax. (85% 失败率)
- **** — The error occurs during parsing, before resolution. (95% 失败率)
