# 错误：无效的需求：'requests ==2.31.0'

- **ID:** `python/pip-invalid-requirement-double-equals-space`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 的需求解析器将包名与版本说明符之间的空格视为独立 token，因此 'requests ==2.31.0' 被解析为两个无效需求。

## 版本兼容性

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

## 解决方案

1. **** (99% 成功率)
   ```
   Remove the space: pip install requests==2.31.0
   ```
2. **** (99% 成功率)
   ```
   Use the PEP 508 form with no space: pip install 'requests==2.31.0'
   ```
3. **** (98% 成功率)
   ```
   Put it in requirements.txt with no space: echo 'requests==2.31.0' > requirements.txt && pip install -r requirements.txt
   ```

## 无效尝试

- **** — Quoting preserves the space; pip still sees the invalid token split and raises the same Invalid requirement error. (85% 失败率)
- **** — The shell passes a literal backslash-space to pip, which is not a valid requirement character and still fails parsing. (90% 失败率)
- **** — The syntax error is independent of the shell/terminal; the malformed requirement string is the cause. (95% 失败率)
