python system_error ai_generated true

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-04-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

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

generic

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 60% fail

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

  2. 40% fail

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