# 错误：由于环境错误无法安装包：[Errno 13] 权限被拒绝：'/root/.cache/pip'

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

## 根因

用户对 pip 缓存目录没有写权限，通常在以非 root 用户运行但目录归 root 所有的环境中出现。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   pip install --cache-dir $HOME/.cache/pip pkg
   ```
2. **** (90% 成功率)
   ```
   pip install --no-cache-dir pkg
   ```

## 无效尝试

- **** — May change ownership and cause permission issues for other users. (50% 失败率)
- **** — May not be advisable in shared environments. (40% 失败率)
