【pytorch下载报错】An HTTP error occurred when trying to retrieve this URL.

时间:2024-03-24 14:05:53

【pytorch下载报错】An HTTP error occurred when trying to retrieve this URL. 续

【pytorch下载报错】An HTTP error occurred when trying to retrieve this URL.


CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/pytorch/win-64/pytorch-1.5.1-py3.7_cuda101_cudnn7_0.tar.bz2>
Elapsed: -

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.


以下来源链接:https://blog.csdn.net/wsjzzcbq/article/details/101052960

报错原因:是 Anaconda 默认从国外镜像源下载,而从国外下载速度极慢,导致报错

解决办法:为 Anaconda 配置国内镜像源。 2019年4 月,由于Anaconda 的授权问题,中科大和清华大学开源软件镜像站先后宣布停止 Anaconda 镜像服务。但在随后的6月份,清华大学经与 Anaconda, Inc. 沟通,获得了镜像的授权,因此我们又能使用清华大学的镜像了。

步骤:

如果给 Anaconda 配置了环境变量,可以直接在 cmd 窗口中执行;如果没有配置环境变量,则在 Anaconda Prompt 中执行

笔者这里没有配置环境变量,在Anaconda Prompt 中执行如下命令,为 Anaconda 配置清华大学镜像源。

【pytorch下载报错】An HTTP error occurred when trying to retrieve this URL.

去找了链接→_→https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/

通过清华的镜像下载对应的版本。下载【pytorch下载报错】An HTTP error occurred when trying to retrieve this URL.

通过本地的方式安装离线的包。以下部分链接:https://blog.csdn.net/u012343685/article/details/106315411/

conda install --use-local pytorch-1.5.1-py3.7_cuda101_cudnn7_0.tar.bz2
这里的path需要主要,因为这里的起始路径是c:/用户/XXX(计算机名称),
所以这里需要先把下载的安装文件copy到c:/用户/XXX(计算机名称)/的路径下。

 现在所有的库已经安装完成,如果测试的时候显示dll找不到的话,说明conda
还没把pytorch进行关联。这个时候,我们需要再运行
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
让conda自动关联起来,再测试就不会有问题了。

【pytorch下载报错】An HTTP error occurred when trying to retrieve this URL.