First, Introduction
Pip is a tool for installing and managing Python packages, and the tools for Python install packages are easy_install, setuptools, Pip,distribute, etc. Distribute is a setuptools alternative to the standard library Disutils module, and we know that disutils is primarily used to package and distribute packages more easily, especially for packages that have dependencies on other packages. Distribute was created because the Setuptools package is no longer maintained. And Pip is a substitute for easy_install.
Second, install Pip
# Apt-get Install Python-pip
Upgrade:
# PIP Install-u pip
Third, PIP package management
Installation package:
[Email protected]:~# pip install djangocollecting Django Using cached django-1.9.5-py2.py3-none-any.whlinstalling Collected packages:djangosuccessfully installed django-1.9.5
Specify the version of the package installed:
by using = =, >=, <=, <, specify a version number.
[Email protected]:~# pip Install markdown==2.0
Upgrade Package:
Upgrade package to current latest version, can use-u or--upgrade
# PIP Install-u Django
Search Package:
# PIP Search "Django"
To list installed packages:
[Email protected]:~# pip freezedjango==1.9.5markdown==2.0
To uninstall a package:
# pip Uninstall Djang
Iv. Requirements Format
The PIP freeze and pip list both list the packages that have been installed, what's the difference. The help explanation is as follows:
Freeze Output installed packages in requirements Format.list list installed packages.
When we use virtualenv, we can specify a requirements.txt file to resolve the dependency and use the following:
# pip Install-r requirements.txt
Requirements.txt has a fixed format: package name = = Version number, each line represents a package. This can be understood by Pip, as follows:
feedparser==5.1.3wsgiref==0.1.2django==1.4.2 ...
This is called "Requirements format"; We can use Pip freeze > Requirements.txt, Export to a file, and then in another place pip Install-r requirements.txt then import.
The difference between the two can be understood as: The PIP list lists all the packages, Pip freeze only lists the packages installed by PIP and outputs them to requirements format.
This article is from "Jason's blog" blog, please be sure to keep this source http://xujunxian.blog.51cto.com/8614409/1769424
PIP Introduction and use