any idea how to update python PIP on a windows box?
[UPDATE 2015-11-15] This post is obsolete and out of date. Current best practice is according to pip is to use the following:
python -m pip install -U pip setuptools
It's not necessary to use easy_install
from setuptools. The recommended procedure to update pip, from the pip-installer page is to use get-pip.py
.
To install or upgrade pip, securely download
get-pip.py
.
You can use the following in a Bash shell like msysgit's Git Bash.
user@machine ~$ curl -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python
Use the -L
option to follow redirects. Recently GitHub changed the url for raw content, so the old raw get-pip.py
url has been redirected and on the pip website the url was changed. If successful, you should see the following:
$ curl -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1309k 100 1309k 0 0 364k 0 0:00:03 0:00:03 --:--:-- 366k
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.6-py2.py3-none-any.whl#md5=4d4fb4b69df6731c7aeaadd6300bc1f2
Installing collected packages: pip
Found existing installation: pip 1.5.4
Uninstalling pip:
Successfully uninstalled pip
Successfully installed pip
Cleaning up...
You can modify this for the Windows command line, but first if you don't have libcurl, download a Windows binary from Curl. You'll want to scroll all the way to the bottom and get Günter Knauf's current official Win32 binary (currently 7.29) and unzip it. Don't worry about it being 32-bit versus 64-bit. Just make sure you get the one with all the bells and whistles (ssl, zlib, etc.). Now navigate to the folder where you downloaded curl, probably c:\Users\<you>\Downloads
, open the extracted folder, probably curl-7.29.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32
, and you should find curl.exe
. Yay! Now in a windows shell type this after the prompt (which will have your username instead of myusername
), replacing path\to\Curl\
with the path to the downloaded curl.exe
file.
C:\Users\myusername> path\to\Curl\curl.exe -kL https://bootstrap.pypa.io/get-pip.py | python
You need the -k
option to allow curl to access the secure GitHub pip site without certs. Also, thanks Piotr Dobrogost for telling me about Windows pipes, |
, which saves the step of saving the file.
If you already have the latest version of pip you will get the following message:
$ curl https://bootstrap.pypa.io/get-pip.py | python
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1309k 100 1309k 0 0 369k 0 0:00:03 0:00:03 --:--:-- 371k
Requirement already up-to-date: pip in c:\python27\lib\site-packages
Cleaning up...
Also works just fine in virtualenvs.
easy_install -U pip
:-)
Run pip as a script, using python as the main executable.
python -m pip install -U pip