为 Ubuntu/Anaconda/pip 添加国内下载源

背景

正在看 tensorflow-lite 压缩模型的部分,结果 tutorial 一上来就要卸旧版安装 tf-nightly (新版?反正小白下就vans了)
然而好不容易才编译好源码舍不得删。又建了一个 env 下载新版,速度慢的一比,挂了一上午还超时断了。
我寻思着好像之前同学帮我配过国内的镜像下载源,试了一下。

“一键使用TUNA”服务

按照清华开源软件镜像站上面说的步骤,进行如下操作就可以一键为Anaconda/PyPi/Ubuntu Linux等添加清华镜像:

wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py
# For yourself
python oh-my-tuna.py
# ...or for everyone!
sudo python oh-my-tuna.py --global
# Get some help
python oh-my-tuna.py -h

但实测时,仅发现 /etc/apt/sources.list 文件修改了,但 pip 下载时并没有提速,暂未查明原因

手动修改 pip 下载源

Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹),内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

实测 pip 下载提速较为明显

手动修改 conda 下载源

运行以下命令:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

实测提速明显

参考资料:

  1. https://tuna.moe/oh-my-tuna/
  2. https://www.cnblogs.com/microman/p/6107879.html
  3. https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

转载于:https://www.cnblogs.com/southtonorth/p/9703494.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值