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
80%Fix Rate
86%Confidence
0Evidence
2025-01-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 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
-
90% success Install with --user flag
pip install --user package_name
-
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:
-
Using sudo pip install
40% fail
Risky and may break system Python packages.
-
Changing directory permissions
30% fail
May cause system instability.