PIP Introduction and use

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.