Home > python > pip install –user

pip install –user

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
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: