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

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],如:

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

2.永久生效:

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

[global]
index-url = http://mirrors.aliyun.com/pypi/simple
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/

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

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

$ conda config --show

这里写图片描述

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

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

猜你喜欢

转载自blog.csdn.net/ksws0292756/article/details/79511485