12

I'm trying to get pip to point to a different install rather than the default. It is currently pointing to /usr/bin/pip, but I want it to point to /usr/local/bin/pip. I believe I have the path set correctly and everything else points to the correct location.

What's the best way to resolve this?

# echo $PATH
/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin

# which python
/usr/local/bin/python

# which easy_install
/usr/local/bin/easy_install

# which pip
/usr/bin/pip
  • 2
    Does /usr/local/bin/pip exist and is it executable for your user? – HBruijn Feb 27 '15 at 5:04
  • What does which -a pip output? – Bandrami Feb 27 '15 at 5:58
  • /usr/local/bin/pip does exist for users. # which -a pip /usr/local/bin/pip /usr/bin/pip /usr/local/bin/pip – Andrew Saxe Feb 27 '15 at 18:16
6

Using 'alias' is another possible option. Just put it into the relevant shell configuration file (for execution each time your shell is executed).

$ alias pip='/usr/bin/pip'
$ alias pip
alias pip='/usr/bin/pip'
$ alias pip='/usr/local/bin/pip'
$ alias pip
alias pip='/usr/local/bin/pip'
$ pip
bash: /usr/local/bin/pip: No such file or directory
| improve this answer | |
5

It seems that you have both pip installed via easy_install and OS package manager. If you want to use only one, just remove another one.

In your case, you want pip from easy_install, so just removing which one from OS package manager.

With Debian/Ubuntu:

sudo apt-get purge python-pip

With Redhat/Centos/Fedora:

sudo yum remove python-pip
| improve this answer | |
1

You can specify PATH to local pip in ~/.bash_profile file. Supposed that you you would like to use pip from /usr/local/bin/pip, you can add export PATH=$HOME/usr/local/bin:$PATH to the file. This will add the desired PATH to existing PATH ($PATH).

Then, source ~/.bash_profile to update the PATH.

Check pippath again by typing which pip.

| improve this answer | |
0

Edit your ~/.bashrc file to include the path to your preferred pip installation. E.g.

alias pip='/usr/bin/pip'

Then source your .bashrc file for it to come into action.

source ~/.bashrc

Check: which pip

/usr/bin/pip

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy