Pax0r
Pax0r

Reputation: 2473

Python using diffrent pip version that in PYTHONPATH

I installed python 2.7 on mine shared host (it already had python 2.6 but they didnt want to upgrade it or install any packages) and pip. Configured PYTHONPATH and PATH in .bashrc. I dont have root access to this machine.

When I am checking sys.path with mine python installation it does not reference anywhere this shared location.

I checked commands:

which python
which pip

output:

/home/mgx/python27/bin/pip

and both provides me to mine installation but using

pip --version

output:

pip 1.1 from /usr/local/lib/python2.6/dist-packages/pip-1.1-py2.6.egg (python 2.6)

I can see that it using version from /usr/ not mine. How can I force it to use mine pip version? When I try to install with mine pip version by direct address it everything works but the short pip command is using wrong one. Also strange is that 'which' command show the good one...

Edit: output of cat $(which pip) and outputs of previous commands

#!/home/mgx/python27/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.4.1','console_scripts','pip'
__requires__ = 'pip==1.4.1'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
    )

Upvotes: 0

Views: 1838

Answers (1)

flyingfoxlee
flyingfoxlee

Reputation: 1794

I think you may change your PATH variable so that your /home/mgx/python27/bin is searched first. Add the following line to you .bashrc and souce it afterward.

PATH=/home/mgx/python27/bin:$PATH

Then

source .bashrc

Or you could just alias pip in your .bashrc

alias pip='/home/mgx/python27/bin/pip'

I think this would fix it.

Upvotes: 1

Related Questions