1. 背景
anaconda的安裝雖然非常方便,能夠自動安裝相關依賴,但是常常在安裝一些大包的時候,會出現CondaHTTPError:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/pytorch-1.6.0-py3.6_cuda10.1.243_cudnn7.6.3_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.
2. 解決
先下載需要安裝的包,再進行離線安裝。
首先是安裝包要從什么地方下載的問題,從上面的提示其實已經提示了url(https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/pytorch-1.6.0-py3.6_cuda10.1.243_cudnn7.6.3_0.tar.bz2),直接下載。
下載完成后,在離線包所在文件夾進行安裝:
conda install --use-local pytorch-1.6.0-py3.6_cuda10.1.243_cudnn7.6.3_0.tar.bz2
注意,網上說的另外一個命令:
conda install -c local [package_name]
其中,--use-local 和 -c local 是一樣的效果,其中有一些文章說需要先解壓然后安裝,其實是誤人子弟。
3. 參考
anaconda官網文檔:https://conda.io/projects/conda/en/latest/commands/install.html?highlight=use-local#Channel%20Customization
(完)