Use pip several ways to install python library

Operating System: CentOS7.5.1804_x64

Python Version: 3.6.8

1, pip-line installation

1.1 installing a single package

Format is as follows:

pip install SomePackage

Examples are as follows:

For example: PIP the install SciPy 
or specified version Installation: PIP the install SciPy == 1.3 . 0

Mounting a plurality of package 1.2

Examples are as follows:

pip install -r req.txt

req.txt available through the following command:

pip freeze > req.txt

1.3 Other installation problems online

1.3.1 agent problem

If you need to install the agent may use the following format:

pip --proxy=ip:port install SomePackage

1.3.2 pip Sources

If the source is too slow pip, pip source can be replaced, there are two ways:

One way: temporary modification of the source by modifying the parameters pip

Such as the use Ali cloud pip Source:

pip install Sphinx -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

Second way: permanent changes by modifying the configuration file source pip

File: ~ / .pip / pip.conf

Such as the use Ali cloud pip Source:

[admin@localhost .pip]$ cat ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
extra-index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

[admin@localhost .pip]$

Source may be used self pip, pip or other sources disclosed, such as:

Ali cloud HTTP: // mirrors.aliyun.com/pypi/simple/ 
watercress (douban) HTTP: // pypi.douban.com/simple/ 
Tsinghua University HTTPS: // pypi.tuna.tsinghua.edu.cn/simple/ 
University of Science and technology of China HTTP: // pypi.mirrors.ustc.edu.cn/simple/

2, from the source installation

Examples are as follows:

git clone https://github.com/sphinx-doc/sphinx
cd sphinx
pip install .

3, the installation files from whl

Format is as follows:

pip install SomePackage.whl

 

This article github Address:

https://github.com/mike-zhang/mikeBlogEssays/blob/master/2019/20190730_ use pip to install python libraries in several ways .rst

Welcome to add

Guess you like

Origin www.cnblogs.com/MikeZhang/p/pip20190730.html