python
system_error
ai_generated
true
错误:由于 OSError 无法安装包:[Errno 13] 权限被拒绝:'/usr/local/lib/python3.11/site-packages/foo'
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/lib/python3.11/site-packages/foo'
ID: python/pip-permission-denied-site-packages
80%修复率
88%置信度
0证据数
2024-11-09首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
在没有写权限的情况下向系统级 site-packages 安装。
English
Installing into a system-wide site-packages without write permission.
解决方案
-
95% 成功率
python -m venv .venv && source .venv/bin/activate && pip install foo
-
90% 成功率
pip install --user foo
无效尝试
常见但无效的做法:
-
50% 失败
Mixes root-owned files into user environment, causing future permission errors and security risks.
-
80% 失败
Weakens system security and does not address root cause.