Python's software Management

Source: Internet
Author: User
Tags virtual environment

Common Package management Tools

General Python package management tools, mainly include the following:

Figure Common Python package management tool

You can see that distribute is an alternative to setuptools (because the Setuptools package is no longer maintained), and Pip is an alternative to easy_install. This article focuses on PIP and other interested self-knowledge.

Pip's most popular package management tool

One of Pip's core developers, Donald Stufft, wrote a blog last year detailing the traffic for the PyPI CDN provider for 4 days. One of the latitude shows that about 75% of users using package management tools to install packages from PyPI use PIP. The tool has been proven to be very useful and Popular, and Pip will be released from the 3.4 version, with Python built-in .

Figure: PyPI Installation Tool usage chart (https://caremad.io/2013/10/a-look-at-pypi-downloads/)

PyPI Home Page Recommended Package installation method:

Installation

Method One:

L download get-pip.py file, https://bootstrap.pypa.io/get-pip.py

L Python get-pip.py

D:\python33>python get-pip.py

downloading/unpacking pip

Downloading/unpacking Setuptools

Installing collected Packages:pip, Setuptools

Successfully installed PIP Setuptools

Cleaning up ...

Mode two: Source mode installation

L Download Source package: https://pypi.python.org/packages/source/p/pip/

L Decompression

L CD to corresponding directory

L Python setup.py Install

Use

L Install packages from PyPI:

Install a package from PyPI:
$ pip Install somepackage [...] Successfully installed Somepackage

Install a package already downloaded from PyPI or got elsewhere. This is useful if the target machine does not has a network connection:

Pip Install SOMEPACKAGE-1.0-PY2.PY3-NONE-ANY.WHL

• See what files and paths are installed on the package: $ pip show -- files somepackage name:somepackage Version:1.0Location :/my/env/lib/pythonx.x/site-packages Files:../somepackage/__init__. py [...] l See which packages are already in the updated version: $ pip list -- outdated somepackage (current:1.0 latest:2.0) L Upgrade Package: $ pip install -- upgrade Somepackage [...] Found existing Installation:somepackage1.0Uninstalling somepackage:successfully uninstalled somepackage Running setup.py install forSomepackage successfully installed Somepackagel Uninstall Package: $ pip uninstall somepackage uninstalling Somepac Kage:/my/env/lib/pythonx.x/site-packages/somepackage Proceed (y/N)? Y successfully uninstalled Somepackage

Pip Advanced Usage

The previous section describes the basic performance of Pip, which has met most of the requirements. Here are some advanced uses of PIP:

L   " Query " l  List all packages installed $ pip Listl  The specified version number of the installation package by using = =, >=, <=,;, < to specify a version number $ pip Install Somepackage            #  Latest Version$ pip install somepackage==1.0.4     #  Specific version'somepackage>=1.0.4'     #  Minimum Version

Upgrading PIP
or OS X:-U pip
On Windows: -M PIP install-u Pip

• Install packages based on dependent files

Imagine a scenario where you create a feeling virtual environment with the elegant use of Python's environment management, and then install some dependent packages to develop the app app. This time, you need to deploy to the server?

You can use PIP to export a list of dependent files and then install the corresponding packages automatically on the server based on the list of dependent files. is not very convenient!

Pip Freeze > Requirements.txt

Pip Install-r requirements.txt

Related connections:

Https://pip.pypa.io/en/latest/installing.html

Https://pip.pypa.io/en/latest/quickstart.html

Python's software Management

Related Article

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.