pip is a Python package management tool that provides a Python package to find, download, install, uninstall function.
Currently, if you download the latest version of the installation package python.org, it is already comes with the tool.
Python 2.7.9 or later + Python 3.4+ comes with pip tool.
pip official website: https://pypi.org/project/pip/
First, check whether the installation pip
Can be judged by the following command has been installed:
pip --version or pip -V
Example: (Windows under)
C:\Users\Tom> pip -V pip 19.3.1 from e:\program files\python3.6.5\lib\site-packages\pip (python 3.6)
Two, pip installation
If you have not yet installed, you can use the following methods to install:
$ Curl HTTPS: // bootstrap.pypa.io/get-pip.py -o get-pip.py # script to download and install $ sudo Python GET-PIP. Py # run the installation script
Note: Which version of Python run the installation script, pip was linked to which version, if it is Python3 execute the following command:
$ Sudo python3 get-pip.py # run the installation script
Generally pip corresponds Python 2.7, pip3 corresponds Python 3.x.
Part of the Linux distributions directly with your package manager to install pip, such as Debian and Ubuntu:
sudo apt-get install python-pip
Three, pip tools commonly used commands
Display version and path
pip --version or pip -V
Getting Help
pip --help
Upgrade pip
pip install -U pip
If the above problems with this upgrade command, you can use the following command
sudo easy_install --upgrade pip 或者 python -m pip install --upgrade pip
Installation package
PIP the install somepackage # latest version PIP the install somepackage == 1.0 . . 4 # specified version PIP the install ' somepackage> = 1.0.4 ' # minimal version
For example, I want to install Django. With the following single command, and convenient.
pip install Django==1.7
Upgrade package
pip install --upgrade SomePackage
Upgrade package specified by using ==,> =, <=,>, <to specify a version number.
Uninstall package
pip uninstall SomePackage
Search package
pip search SomePackage
Shows the installation package information
pip show
or
pip show SomePackage
Example:
C:\Users\Tom> pip3 show pandas Name: pandas Version: 0.25.3 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: http://pandas.pydata.org Author: None Author-email: None License: BSD Location: e:\program files\python3.6.5\lib\site-packages Requires: python-dateutil, pytz, numpy Required-by:
View details specified package
pip show -f SomePackage
List installed packages
pip list
Example:
C:\Users\Tom> pip3 list Package Version --------------- ---------- beautifulsoup4 4.6.3 certifi 2018.10.15 chardet 3.0.4 get 1.0.3 idna 2.7 lxml 4.2.5 numpy 1.17.4 pandas 0.25.3 pip 19.3.1 post 1.0.2 public 1.0.3 python-dateutil 2.8.1 pytz 2019.3 query-string 1.0.2 request 1.0.2 requests 2.20.0 setuptools 39.0.1 six 1.13.0 urllib3 1.24.1
Check scalable package
pip list -o
IV Notes
If Python2 and Python3 while pip command is used as follows:
Python2:
python2 -m pip install xxx
Python3:
python3 -m pip install xxx