在通过vscode向服务器安装pytorch时,切换了清华源之后,遇到了下面的错误:
An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way.
遇到此错误的时添加的清华源如下:
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
解决方案:
将添加的清华源地址中的https改为http,添加清华源如下:文章来源:https://www.toymoban.com/news/detail-649999.html
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
改为http后再运行pytorch安装命令就不会出现上面所提到的错误,如下图所示:
附:
清空源命令:文章来源地址https://www.toymoban.com/news/detail-649999.html
conda config --remove-key channels
到了这里,关于An HTTP error occurred when trying to retrieve this URL.(解决方案)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!