anaconda 离线安装包
原文链接:https://www.cnblogs.com/harrymore/p/13722675.html
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
(完)