pip install –user and your path
Posted by jpluimers on 2020/06/09
I’ve added this to my ~/.bashrc
to stuff installed by pip install --user
is accessible from interactive shells:
# set PATH so it includes user's private python "pip --user" bin if it exists if [ -d "$HOME/.local/bin" ] ; then PATH="$PATH:$HOME/.local/bin" fi
The addition is at the end of the path. It is a choice: it means machine installs take prevalence over user installs. That’s usually what I want. For more considerations (including non-interactive shells), see [WayBack] bash – How to correctly add a path to PATH? – Unix & Linux Stack Exchange.
The --user
installs do not affect the full system, nor other users.
Further reading:
- [WayBack] python – What is the purpose “pip install –user …”? – Stack Overflow
--user
installs insite.USER_BASE
which luckily is the same for Python 3 and Python 2: [WayBack] Python 3 site.USER_BASE, [WayBack] Python 2 site.USER_BASE- I still need to learn more about the differences between
venv
,virtualenv
,easy_install
,easy_build
,pip install --user
and such as even this SO question has inconclusive answers: [WayBack] What’s the proper way to install pip, virtualenv, and distribute for Python? – Stack Overflow - Easy Build:
- Install: [WayBack] Installing EasyBuild — EasyBuild v3.5.3 documentation (release 20180307): Bootstrap procedure
- Source: [WayBack] GitHub – easybuilders/easybuild: EasyBuild – building software with ease
- [WayBack] EasyBuild documentation — EasyBuild v3.5.3 documentation (release 20180307)
- [WayBack] easybuild 3.5.3 : Python Package Index
- [WayBack] EasyBuild: building software with ease
- [WayBack] installing – What is the simplest way to do a user-local install of a python package? – Computational Science Stack Exchange
–jeroen
Leave a Reply