What is the purpose of "pip install --user ..."?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 What Is The Purpose Of &Quot;Pip Install --User ...&Quot;?
00:31 Accepted Answer Score 462
00:50 Answer 2 Score 40
01:12 Answer 3 Score 30
01:33 Answer 4 Score 61
01:58 Thank you
--
Full question
https://stackoverflow.com/questions/4298...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python3x #pip #virtualenv
#avk47
ACCEPTED ANSWER
Score 462
pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4). This requires root access.
--user makes pip install packages in your home directory instead, which doesn't require any special privileges.
ANSWER 2
Score 61
Just a warning:
According to this issue, --user is currently not valid inside a virtual env's pip, since a user location doesn't really make sense for a virtual environment.
So do not use pip install --user some_pkg inside a virtual environment, otherwise, virtual environment's pip will be confused. See this answer for more details.
ANSWER 3
Score 40
--user installs in site.USER_SITE.
For my case, it was /Users/.../Library/Python/2.7/bin. So I have added that to my PATH (in ~/.bash_profile file):
export PATH=$PATH:/Users/.../Library/Python/2.7/bin
ANSWER 4
Score 30
Other answers mention site.USER_SITE as where Python packages get placed. If you're looking for binaries, these go in {site.USER_BASE}/bin.
If you want to add this directory to your shell's search path, use:
export PATH="${PATH}:$(python3 -c 'import site; print(site.USER_BASE)')/bin"