# 错误：这些包与 requirements 文件中的哈希值不匹配。如果您更新了包版本，请更新哈希值。否则，请仔细检查包内容；可能有人篡改了它们。

- **ID:** `python/pip-install-error-hash-mismatch`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

下载的包的哈希值与 requirements 文件中指定的哈希值不匹配，表明版本不匹配或篡改。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   pip hash package.whl  # then update requirements.txt with the new hash
   ```
2. **** (85% 成功率)
   ```
   pip freeze > requirements.txt && pip hash package.whl >> requirements.txt
   ```
3. **** (80% 成功率)
   ```
   pip download package --no-deps -d /tmp && pip install --require-hashes -r requirements.txt
   ```

## 无效尝试

- **** — This bypasses security checks and is not recommended. (80% 失败率)
- **** — The hash mismatch persists unless the package is updated. (90% 失败率)
- **** — Force reinstall does not bypass hash verification. (95% 失败率)
