pip installation and mirror source settings

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

1. pip installation
1. Install using script
Visit the official website http://pip-cn.readthedocs.io/en/latest/installing.html#get-pip to
download the get-pip.py file,
and then run the following command (administrator required) Permissions)::python get-pip.py
The new version of pip installation does not need to install setuptools manually, and setuptools will be automatically installed when installing pip, but when the old version of pip is installed, setuptools needs to be installed first

2. Use system software management Install the
yum install python-pip

3, pip package,
visit https://pypi.python.org/pypi/pip/9.0.1pip to download the latest package (pip-9.0.1.tar.gz), press Install
druid@master in the following order:/soft/pip-9.0.1$ tar -xvf pip-9.0.1.tar.gz 
druid@master:/soft/pip-9.0.1$ cd pip-9.0.1/ 
druid@ master:/soft/pip-9.0.1$ sudo python setup.py install 


Second, mirror settings

   Since the speed of accessing foreign websites may be very slow, you can set the mirror of pip to the relevant mirror address in China. The mirror addresses that are easy to use in China are:
Douban source: http://pypi.douban.com/simple/Tsinghua
University: http://pypi.tuna.tsinghua.edu.cn/simple

1. Specify the mirror address by command line

pip install -i http://pypi.douban.com/simple/ packagename

2. If configured as default, you need to create or modify configuration files (linux files are placed in ~/.pip/pip.conf, windows are in %HOMEPATH% \pip\pip.ini, directory does not exist, created manually)

[druid@master .pip]$ pwd
/home/druid/.pip
[druid@master .pip]$ more pip.conf
[global]
index-url=https ://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326593743&siteId=291194637