pip默认安装包是从网站https://pypi.org/simple下载,我们可以将其改成国内的镜像网站,加速下载过程,下面以安装numpy库为例:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
下载其它库时,将numpy改成需要的库名即可。(使用pip、pip2 or pip3根据指向的python版本即可确定。)
在终端中输入pip install -help可以发现参数"-i"的作用:
Package Index Options:
-i, --index-url <url> Base URL of Python Package Index (default
https://pypi.org/simple). This should point to a
repository compliant with PEP 503 (the simple
repository API) or a local directory laid out in
the same format.
清华镜像资源:
https://pypi.tuna.tsinghua.edu.cn/simple
转自:https://www.cnblogs.com/wuliytTaotao/p/9457159.html
本文介绍如何通过更改pip的默认源为国内镜像站点,如清华大学的镜像资源,来显著提高Python库的下载速度。使用-i参数指定镜像源地址,适用于pip、pip2或pip3。

1651

被折叠的 条评论
为什么被折叠?



