python system_error ai_generated true

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

ID: python/pip-permission-denied

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.10 active

Root Cause

The user does not have write permissions to the site-packages directory, often due to system Python installation.

generic

中文

用户对site-packages目录没有写权限,通常由于系统Python安装。

Workarounds

  1. 95% success
    python -m venv venv && source venv/bin/activate && pip install package
  2. 80% success
    pip install --user package
  3. 85% success
    pipx install package

Dead Ends

Common approaches that don't work:

  1. 50% fail

    Risky and may corrupt system packages.

  2. 70% fail

    May break system Python integrity.

  3. 40% fail

    Installs to user site but may not be in PATH.