pip设置镜像源极速下载

35次阅读

共计 414 个字符,预计需要花费 2 分钟才能阅读完成。

由于不能说的原因,安装部分包时经常断掉,或者非常缓慢,在没有科学上网的条件下,选择镜像就是非常靠谱的办法

临时使用

  • 阿里的镜像

pip install -i https://mirrors.aliyun.com/py… some-package

  • 清华的镜像(推荐教育网使用)

pip install -i https://pypi.tuna.tsinghua.ed… some-package

注意,simple 不能少, 是 https 而不是 http

全局设置

设为默认

pip config set global.index-url https://mirrors.aliyun.com/py…

或修改对应的文件 ~/.pip/pip.conf%HOMEPATH%\pip\pip.ini

 [global]
 trusted-host =  mirrors.aliyun.com
 index-url = https://mirrors.aliyun.com/pypi/simple

正文完
 0