Linux系统pip、conda等包管理程序下载速度慢

今天药忘吃喽~ 2022-05-30 10:48 191阅读 0赞

Linux系统pip、conda等包管理程序下载速度慢的主要原因是默认的下载镜像源是国外的,而解决方法是修改镜像源到国内即可,具体如下

pip

目前可用源:
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
http://mirrors.aliyun.com/pypi/simple/ 阿里云
https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学

1.临时使用:

可以使用pip时添加参数 -i[url],如:

  1. pip install -i http://pypi.douban.com/simple/ gevent

2.永久生效:

修改~/.pip/pip.conf,修改index-url至相应源
(如果没有该文件或文件夹,就先在home下创建.pip文件夹,再在.pip文件夹里面创建.pip.conf文件)

  1. [global]
  2. index-url = http://mirrors.aliyun.com/pypi/simple
  3. trusted-host = mirrors.aliyun.com #对应阿里云的host,其他的可以自己查一下,也可以不写这一句

conda

可用源
清华
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
中科大
http://mirrors.ustc.edu.cn/anaconda/pkgs/free/

  1. $ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

然后可以输入下面的指令查看当前的源:

  1. $ conda config --show

这里写图片描述

或者修改成.condarc文件,在文件中输入下面的指令。

  1. channels:
  2. - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - defaults show_channel_urls: true

发表评论

表情:
评论列表 (有 0 条评论,191人围观)

还没有评论,来说两句吧...

相关阅读