pip 换成国内阿里镜像源

2019-07-25 18:42:23 浏览数 (1)

当你写代码写得正嗨,需要下载一个第三方库,看着 pip 的速度如同快用光的牙膏,使用挤才能一点点出来,恍然有一种太监上青楼的无力感...

好在,我们有镜像可以续命

以下演示在 linux 换 pip 镜像的流程 (mac 也适用)

代码语言:javascript复制
$ mkdir -p $HOME/.config/pip
$ touch $HOME/.config/pip/pip.conf
代码语言:javascript复制
$ cat $HOME/.config/pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

现在下载速度杠杠的

代码语言:javascript复制
$ pip install beautifulsoup4
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting beautifulsoup4
  Downloading https://mirrors.aliyun.com/pypi/packages/1a/b7/34eec2fe5a49718944e215fde81288eec1fa04638aa3fb57c1c6cd0f98c3/beautifulsoup4-4.8.0-py3-none-any.whl (97kB)
     |████████████████████████████████| 102kB 408kB/s
Collecting soupsieve>=1.2 (from beautifulsoup4)
  Downloading https://mirrors.aliyun.com/pypi/packages/35/e3/25079e8911085ab76a6f2facae0771078260c930216ab0b0c44dc5c9bf31/soupsieve-1.9.2-py2.py3-none-any.whl
Installing collected packages: soupsieve, beautifulsoup4 
Successfully installed beautifulsoup4-4.8.0 soupsieve-1.9.2

题图

0 人点赞