Python Package management tool-PIP installation and use guide

Source: Internet
Author: User
This article mainly introduces the Python package management tool-PIP Installation use guide, small series feel very good, now share to everyone, also for everyone to do a reference. Let's take a look at it with a little knitting.

"Preface"

Python has two well-known package management tools easy_install.py and PIP. In Python2.7 's installation package, easy_install.py is installed by default, and Pip requires us to install it manually.

Pip can be run on Unix/linux, OS X, and Windows platforms, support CPython versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 and also pypy.

"Download"

Download Pip's installation package get-pip.py, download address: Https://pip.pypa.io/en/latest/installing.html#id7

"Install Pip on Windows"

Starting with Pip v1.5.1, installation is simple, running directly as an administrator in the directory where get-pip.py resides

Python get-pip.py

After execution, in the Python installation directory under the Scripts subdirectory, you can see Pip.exe, Pip2.7.exe, Pip2.exe, etc., which indicates that PIP installation was successful.

Note: To be able to run the PIP program directly on the command line, you need to scripts this directory into the environment variable path.

PIP installation can also be installed using the installation options, such as specifying the location of the get-pip.py:

Python get-pip.py--no-index--find-links=c:\downloads

"Install Pip on Linux"

On Linux, it is easy to install by using the Package management tool on the Linux distribution. For example:

On Debian and Ubuntu:

sudo apt-get install Python-pip

On Fedora:

sudo yum install Python-pip

"Upgrade Pip"

On Linux or OS X:

Pip Install-u pip

On Windows:

python-m Pip install-u pip

"Usage"

Install a package from PyPI:

Pip Install Somepackage

Install a specific version of the package by using = =, >=, <=, <, to specify a version number.
Pip install ' markdown<2.0 '
Pip Install ' markdown>2.0,<2.0.3

If you have requirement, direct PIP Install-r requirements.txt can install all of them.

Uninstall a package:

Pip Uninstall Somepackage

Upgrade a package:

Pip Install--upgrade somepackage

Show what files were installed:

Pip Show--files Somepackage

List What packages is outdated:

Pip List--outdated

"Practice"

Install Selenium on Windows 7:

Verify, start-All Programs--python 2.7---IDLE (Python GUI), enter the following code, and perform if the error is not indicated, the selenium installation is successful.

From selenium import webdriverfrom selenium.common.exceptions import Timeoutexceptionfrom Selenium.webdriver.support.ui Import webdriverwait

There is also a way to execute

Pip Show--files Selenim

The result of the execution is to list all the files for the Selunium package.


"References"

Https://pypi.python.org/pypi/pip

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.