python system_error ai_generated true

错误:由于 OSError 无法安装包:[Errno 13] 权限被拒绝:'/usr/local/lib/python3.10/site-packages'

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/lib/python3.10/site-packages'

ID: python/pip-install-permission-denied-site-packages

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2024-04-05首次发现

版本兼容性

版本状态引入弃用备注
3.x active

根因分析

用户对系统范围的 site-packages 目录没有写权限。

English

The user lacks write permissions to the system-wide site-packages directory.

generic

解决方案

  1. 98% 成功率
    python -m venv myenv; source myenv/bin/activate; pip install package
  2. 85% 成功率
    pip install --user package

无效尝试

常见但无效的做法:

  1. 60% 失败

    May cause permission issues for other users and is not recommended in virtualenvs.

  2. 40% 失败

    Installs to user site-packages, which may not be in PATH or may conflict with system packages.