Back to Python#Installation

See also virtualenv

pip

A tool for installing and managing Python packages.

1. pip vs easy_install

https://packaging.python.org/pip_easy_install/

https://pypi.python.org/pypi/setuptools

2. Installation

wget https://bootstrap.pypa.io/2.6/get-pip.py # for python 2.6
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

3. Useful Commands

3.1. pip upgrade to 1.3.1

pip --version
pip install -U pip

3.2. install a specific version

pip install 'SomeProject==1.4'
pip install 'SomeProject>=1,<2'
pip install 'SomeProject~=1.4.2'

3.3. local install

#download to local but can not directly use
pip install fabric -d /srv/fabric/pip-cache/ --timeout 1000
#Using download cache next time
pip install -U fabric --download-cache /srv/fabric/pip-cache/

3.4. HashMismatch: Bad md5 hash for package

http://stackoverflow.com/questions/16025788/why-does-pip-fail-with-bad-md5-hash-for-package

Bad md5 hash for package https://pypi.python.org/packages/cp27/n/numpy/numpy-1.9.3-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl#md5=039bf0fc94df838878f40c94e12fb1e7 (from https://pypi.python.org/simple/numpy/)
Storing debug log for failure in /Users/liyan/.pip/pip.log

Found link https://pypi.python.org/packages/source/n/numpy/numpy-1.9.3.tar.gz#md5=7c321721ffc62c25bc854b8addf42f20 (from https://pypi.python.org/simple/numpy/), version: 1.9.3

j tmp
(env)➜  tmp  wget https://pypi.python.org/packages/source/n/numpy/numpy-1.9.3
(env)➜  tmp  md5sum numpy-1.9.3.tar.gz 
7c321721ffc62c25bc854b8addf42f20  numpy-1.9.3.tar.gz ##match md5
(env)➜  tmp  pip install  numpy-1.9.3.tar.gz
...
Successfully installed numpy
Cleaning up...

4. Useful Packages

4.1. moin & uwsgi

➜  ~  pip search uwsgi
...
uWSGI                     - The uWSGI server
...

➜  fabric  pip search moin
moin                      - MoinMoin 1.9.2 is an easy to use, full-featured
                            and extensible wiki software package
editmoin                  - Edit Moin pages remotely with your preferred
                            editor
moomin                    - Moinmoin client
...

5. Reference

MainWiki: pip (last edited 2013-07-10 19:36:01 by twotwo)