pip 換成國內阿里映象源

it書童發表於2019-11-19

當你寫程式碼寫得正嗨,需要下載一個第三方庫,看著 pip 的速度如同快用光的牙膏,使用擠才能一點點出來,恍然有一種太監上青樓的無力感...

好在,我們有映象可以續命

以下演示在 linux 換 pip 映象的流程 (mac 也適用)

$ mkdir -p $HOME/.config/pip
$ touch $HOME/.config/pip/pip.conf
$ cat $HOME/.config/pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

現在下載速度槓槓的

$ 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

原文 https://www.itshutong.com/359.html

本作品採用《CC 協議》,轉載必須註明作者和本文連結
it書童

相關文章