What tools are commonly used to install extension libraries in Python?

爱喝马黛茶的安东尼
Release: 2020-01-06 10:08:57
Original
15375 people have browsed it

What tools are commonly used to install extension libraries 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
Copy after login
Copy after login

If you have not installed it yet , 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    # 运行安装脚本
Copy after login

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    # 运行安装脚本。
Copy after login

Generally, pip corresponds to Python 2.7, and pip3 corresponds to Python 3.x.

Some Linux distributions can directly use the package manager to install pip, such as Debian and Ubuntu:

sudo apt-get install python-pip
Copy after login

pip’s most commonly used commands

Show version and path

pip --version
Copy after login
Copy after login

Get help

pip --help
Copy after login

Upgrade pip

pip install -U pip
Copy after login

If there is a problem with this upgrade command, you can use the following command:

sudo easy_install --upgrade pip
Copy after login

Installation package

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

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

pip install Django==1.7
Copy after login

Upgrade package

pip install --upgrade SomePackage
Copy after login

Upgrade the specified package by using ==, >=, <=, >, < to specify a version number .

Uninstall package

pip uninstall SomePackage
Copy after login

Search package

pip search SomePackage
Copy after login

Display installation package information

pip show
Copy after login

View detailed information of the specified package

pip show -f SomePackage
Copy after login

List installed packages

pip list
Copy after login

View upgradeable Package

pip list -o
Copy after login

Notes

If Python2 and Python3 have pip at the same time, the usage method is as follows:

Python2:

python2 -m pip install XXX
Copy after login

Python3:

python3 -m pip install XXX
Copy after login

python learning network, free online learning python platform, welcome to follow!

The above is the detailed content of What tools are commonly used to install extension libraries in Python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template