Introduction to Python package management tools easy_install, setuptools, Pip, and distribute

Source: Internet
Author: User

When I first started learning Python, I used easy_install, setuptools, and pip and distribute in reading the document and other blogs to introduce the installation packages. What is the relationship between these tools, you can see the figure below.


We can see that distribute is replaced by setuptools, while pip is replaced by easy_install.

 

For more information about these package tools, seeHttp://guide.python-distribute.org/installation.html#installing-pip

 

The following is a brief introduction:

Distrils is an enhancement to the standard library's disutils module. We know that disutils is mainly used for easier packaging and distribution of packages, especially for packages that are dependent on other packages.

Distribute is created because the Setuptools package is no longer maintained.

Install Distribute

You can use distribute_setup.pyYou can install Distribute by using easy_install, pip, and source files. However, using distribute_setup.py is the simplest and most popular installation method.

 

$ curl -0 http://python-distribute.org/distribute_setup.py
$ sudo python distribute_setup.py

 

Pip is a tool for installing python packages. It provides the installation package to list installed packages, upgrade packages, and uninstall packages.

Pip is a replacement of easy_install and provides the same search Package function as easy_install. Therefore, you can use the package installed by easy_install or pip for installation.

 

Install Pip

You can use the source code package, easy_install, or script to install Pip.

The following describes various installation methods:

Source code method:

 

$ Wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz (Replace with the latest package) $ tar xzf pip-0.7.2.tar.gz $ cd pip-0.7.2 $ python setup. py install

Easy_install:

 

$ easy_install pip

Get_pip.py script:

 

$ curl -0 https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ sudo python get-pip.py

 

OK. Let's take a look at Pip usage.

Install package

 

$ pip install Markdown

List Installed packages

 

$ pip freeze

Install a package of a specific version

You can specify a version number by using ==,>=, <=, >,<.

 

$ pip install 'Markdown<2.0'

 

$ pip install 'Markdown>2.0,<2.0.3'

Upgrade package

Upgrade the package to the latest version. You can use-U or -- upgrade

 

$ pip install -U Markdown

Uninstall package

 

$ pip uninstall Markdown

Query package

 

pip search "Markdown"

 

PS -- path of The py file after package installation:/usr/local/lib/python2.7/dist-packages

Transferred from: http://jiayanjujyj.iteye.com/blog/1409819!

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.