How do I upgrade pip on Ubuntu 14.04?

I want to get the latest version (8.1.2) of an item. I am using Ubuntu 14.04 and python 2.7.6. The pip version in Ubuntu repositories is only 1.5.4 (and cannot install things like numpy). How are you really going to upgrade pip? I discovered several ways; they may all be equivalent, but it would be good to know for sure.

Option 1: update pip with pip and change link

apt-get install python-pip pip install --upgrade pip pip --version # still shows 1.5.4 ln -s /usr/local/bin/pip /usr/bin/ pip --version # 8.1.2, success! 

Option 1a: As above, but use python -m pip

 pip install --upgrade pip pip --version # still shows 1.5.4 python -m pip --version # 8.1.2, success! 

Option 2: easy_install

 easy_install -U pip pip --version # 8.1.2, success! 

Option 3: Use virtualenv (I know that virtualenvs are awesome, but I am doing the installation in a docker container, so I was just going to install things all over the world).

 virtualenv test123 source test123/bin/activate pip --version # pip 8.1.2 from ~/test123/local/lib/python2.7/site-packages 

Option 4: The pip site suggests using their get-pip.py script, but also says that this may leave the Ubuntu package manager in an inconsistent state.

Option 5: Updating Python: "pip is already installed if you are using Python 2> = 2.7.9", but this seems like an overkill.

Is one of them the preferred method? Is there a better way I haven't found? Can I say this?

+5
source share
1 answer

The most painless way I've found this is to use install virtualenv and use pip inside virtualenv. This does not even require installing pip at the system level (which you could do by running sudo apt-get install python-pip ):

 sudo apt-get install python-virtualenv # install virtualenv virtualenv venv # create a virtualenv named venv source venv/bin/activate # activate virtualenv pip install -U pip # upgrade pip inside virtualenv 
+4
source

All Articles