python
system_error
ai_generated
true
pytest-cache:无法写入缓存文件:权限被拒绝
pytest-cache: failed to write cache file /path/.pytest_cache/v/cache/lastfailed: [Errno 13] Permission denied
ID: python/pytest-cache-provider-error
80%修复率
87%置信度
0证据数
2025-11-02首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
根因分析
pytest 缓存目录没有写入权限,通常因为运行用户或目录权限设置。
English
pytest 缓存目录没有写入权限,通常因为运行用户或目录权限设置。
解决方案
-
90% 成功率 修改目录权限
chmod -R u+w .pytest_cache
-
85% 成功率 禁用缓存插件
pytest -p no:cacheprovider
无效尝试
常见但无效的做法:
-
删除 .pytest_cache
50% 失败
尝试删除缓存目录但权限问题依然存在
-
chmod 777
40% 失败
尝试修改目录所有者但需要 root 权限