Home  >  Article  >  Backend Development  >  How to use pip in python

How to use pip in python

silencement
silencementOriginal
2019-06-21 09:29:083064browse

How to use pip in python

pip is a Python package management tool that provides the functions of finding, downloading, installing, and uninstalling Python packages.

Currently, if you download the latest version of the installation package from python.org, it already comes with this tool.

Python 2.7.9 or Python 3.4 or above comes with the pip tool.

pip official website: https://pypi.org/project/pip/

You can use the following command to determine whether it has been installed:

pip --version

If it has not been installed, you can Use the following method to install

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py   # 下载安装脚本
$ sudo python get-pip.py    # 运行安装脚本

Note: Which version of Python is used to run the installation script, pip will be associated with that version. If it is Python3, execute the following command:

$ sudo python3 get-pip.py    # 运行安装脚本。

The most commonly used commands for pip

Show version and path

pip --version

Get help

pip --help

Upgrade pip

pip install -U pip

Installation package

pip install SomePackage              # 最新版本
pip install SomePackage==1.0.4       # 指定版本
pip install 'SomePackage>=1.0.4'     # 最小版本

For example, I want to install Django. Just use the following command, which is convenient and quick.

pip install Django==1.7

Upgrade package

pip install --upgrade SomePackage

Uninstall package

pip uninstall SomePackage

Search package

pip search SomePackage

Display installation package information

pip show

View detailed information of the specified package

pip show -f SomePackage

List installed packages

pip list

Notes

The pip in python2 is pip, and the pip in python3 is called pip3. Please pay attention when using it.

The above is the detailed content of How to use pip in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more