pip 换成国内阿里镜像源

当你写代码写得正嗨,需要下载一个第三方库,看着 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

pip
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!