在实验室服务器上配置环境安装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
原因,软件包来源于国外网站,下载速度慢导致安装失败。
Step 1 :在命令行中输入并运行:(清华大学镜像)
-
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
-
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
-
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
-
conda config --set show_channel_urls yes
Step 2 :更改配置文件
按上面的设置镜像源后,把电脑C盘中的.condarc(路径为:C:\Users\Administrator\.condarc)文件以记事本方式打开,把里面的 -defaults这一行删除掉
Step 3 :安装
再输入: conda install pytorch就可以了。
类似的安装其他包就把Pytorch替换下来。
conda install [待安装库名]
出现Proceed ([y]/n)? 输入y即可继续安装。
输入IPython进入anaconda环境下“ import [库]” ,若未报错,则说明安装成功