python system_error ai_generated true

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

ID: python/pip-install-permission-denied

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2025-01-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active

Root Cause

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

generic

中文

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

Workarounds

  1. 90% success Install with --user flag
    pip install --user package_name
  2. 95% success Create a virtual environment
    python -m venv myenv && source myenv/bin/activate && pip install package_name

Dead Ends

Common approaches that don't work:

  1. Using sudo pip install 40% fail

    Risky and may break system Python packages.

  2. Changing directory permissions 30% fail

    May cause system instability.