This article describes how to install pip, a commonly used download and Installation Tool in Python. Note that pip has been integrated by default in Python2.7.9 and 3.4 and later versions. For more information, see
1. Download and install pip
1.1 pip download
# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
1.2 pip Installation
# tar -xzvf pip-1.5.4.tar.gz# cd pip-1.5.4# python setup.py install# tar -xzvf pip-1.5.4.tar.gz# cd pip-1.5.4# python setup.py install
2. pip Usage Details
2.1 pip installation package
# pip install SomePackage
[...] Successfully installed SomePackage
# pip install SomePackage
[...] Successfully installed SomePackage
2.2 pip view installed packages
# pip show --files SomePackage
Name: SomePackage Version: 1.0 Location: /my/env/lib/pythonx.x/site-packages Files: ../somepackage/__init__.py [...]
# pip show --files SomePackage
Name: SomePackage Version: 1.0 Location: /my/env/lib/pythonx.x/site-packages Files: ../somepackage/__init__.py [...]
2.3 pip check which packages need to be updated
# pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
# pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
2.4 pip upgrade package
# pip install --upgrade SomePackage
[...] Found existing installation: SomePackage 1.0 Uninstalling SomePackage: Successfully uninstalled SomePackage Running setup.py install for SomePackage Successfully installed SomePackage
# pip install --upgrade SomePackage
[...] Found existing installation: SomePackage 1.0 Uninstalling SomePackage: Successfully uninstalled SomePackage Running setup.py install for SomePackage Successfully installed SomePackage
2.5 pip uninstall package
$ pip uninstall SomePackage
Uninstalling SomePackage: /my/env/lib/pythonx.x/site-packages/somepackage Proceed (y/n)? y Successfully uninstalled SomePackage
$ pip uninstall SomePackage
Uninstalling SomePackage: /my/env/lib/pythonx.x/site-packages/somepackage Proceed (y/n)? y Successfully uninstalled SomePackage
3. Use pip for domestic sources
Python is very convenient to use pip to install the module. However, official sources in China are always unable to connect intermittently. In fact, python also has installation sources in China, such as Douban. The following describes how to use it.
File Path
Linux
~/.pip/pip.conf
File Content
[global] index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com
Or use the-I command:
easy_install -i http://pypi.douban.com/simple/ saltTesting pip install -i http://pypi.douban.com/simple/ saltTesting