# 错误：无法确定要从缓存中删除哪个条目：...

- **ID:** `python/pip-cache-corruption-error`
- **领域:** python
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 缓存目录损坏，可能是由于并发 pip 进程或磁盘错误。

## 版本兼容性

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

## 解决方案

1. **Clear the entire pip cache** (95% 成功率)
   ```
   `pip cache purge` or manually delete the cache directory (e.g., `rm -rf ~/.cache/pip` on Linux/macOS or `%LocalAppData%\pip\cache` on Windows)
   ```
2. **Use a different cache directory** (85% 成功率)
   ```
   Set `PIP_CACHE_DIR` environment variable to a new path: `export PIP_CACHE_DIR=/tmp/pipcache` then run pip.
   ```

## 无效尝试

- **Reinstalling pip with `pip install --upgrade pip`** — Reinstalling pip does not fix the cache; it only updates the pip executable. (70% 失败率)
- **Running pip with --no-cache-dir temporarily** — This bypasses the cache but does not fix the underlying corruption, which may affect other operations. (40% 失败率)
