最近安装torch的最新版本被清华的源搞得特别难受,总是一半就断连,下面给出几个解决方法,大家一步一步尝试吧,祝好运
1. 在官方查看最新版本的下载指令进行尝试:
https://pytorch.org/get-started/locally/
这里有两种方式,建议大家都尝试一下,万一成功了呢。
pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
或者
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia
不行的话就开始尝试更换下面这些镜像源吧(2021.5)来自博主
北京外国语大学开源软件镜像站
https://mirrors.bfsu.edu.cn/
注:**强烈推荐!!!**2020-05-02 上线,清华大学开源软件镜像站的姐妹站,下载体验极佳,再也不用忍受清华源永远下不完的 pytorch 了。
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.bfsu.edu.cn/anaconda
default_channels:
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/free
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/pro
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
上海交通大学开源软件镜像站
https://mirrors.sjtug.sjtu.edu.cn/
channels:
- defaults
show_channel_urls: true
channel_alias: https://anaconda.mirrors.sjtug.sjtu.edu.cn/
default_channels:
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/main
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/free
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/mro
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/msys2
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/pro
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/r
custom_channels:
conda-forge: https://anaconda.mirrors.sjtug.sjtu.edu.cn/conda-forge
soumith: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/soumith
bioconda: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/bioconda
menpo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/menpo
viscid-hub: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/viscid-hub
atztogo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/atztogo
清华大学开源软件镜像站
https://mirror.tuna.tsinghua.edu.cn/
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
如何替换这些镜像源?
参考:https://blog.csdn.net/weixin_43667077/article/details/108282523
在Ubuntu下就是
备份一下
mv ~/.condarc ~/.condarc_Old
然后编译
vi ~/.condarc
把上面这些任意选一个复制进去
之后使用
source ~/.condarc
报错了没关系哈,接下来
conda info
查看对应的源是不是改好了就好了。