Archive

Posts Tagged ‘local installation’

pip install –user

June 29, 2018 Leave a comment

Problem
When we install something with pip, usually we do a “sudo pip install pkg_name“. However, there are some problems with this approach. First, you need root privileges. Second, it installs the package globally, which can cause conflicts in the system. Is there a way to install something with pip locally?

Solution
The good news is that you can install a package with pip locally too. Under Linux the destination folder by default is ~/.local . Add the following line to the end of your ~/.bashrc :

export PATH=~/.local/bin:$PATH

Then install the package locally. For instance, let’s install pipenv:

$ pip install pipenv --user

Open a new terminal (thus ~/.bashrc is read), and launch pipenv. It should be available. Let’s check where it is:

$ which pipenv
/home/jabba/.local/bin/pipenv
Advertisements