ubuntu镜像下载pytorch,解决time out问题

安装CUDA、CUDnn那些就不赘述,以及下载的pytorch要和自己CUDA版本匹配,比如我的是Ubuntu,CUDA版本为11.6,直接选择对应的。

在安装过,别的提到的方法都试过,比如:

添加清华镜像链接

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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes

但是下载快完成的时候还是会报错。

反复试了下了六次,最后终于找到一个正确的方法。即直接在pytorch官网复制的下载连接后面加入清华镜像,即下面这一句:

-i https://pypi.tuna.tsinghua.edu.cn/simple

比如我原来的下载链接是:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

添加后就成了:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 -i https://pypi.tuna.tsinghua.edu.cn/simple

刚下会报黄,但是可以下载成功。用了别的什么添加镜像链接方法,都不管用。还有一个小tip,如果用conda下不成,就用pip下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值