# 错误：constraints.txt 中的约束行无效：'package1' - 需要版本说明符

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

## 根因

约束文件必须包含带有版本说明符的包名（例如 package1>=1.0），但发现了一个裸包名。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   echo 'package1>=1.0' >> constraints.txt
   ```
2. **** (90% 成功率)
   ```
   sed -i '/^package1$/d' constraints.txt
   ```

## 无效尝试

- **** — Comments are ignored; the invalid line still causes error. (100% 失败率)
- **** — Constraints files have different syntax; using them as requirements may fail. (60% 失败率)
