在pip或conda安装tf、pytorch等其他库时碰到连接超时,或者源无效,例如
UnavailableInvalidChannel: The channel is not accessible or is invalid.
channel name: 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
channel url: https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
error code: 404`
可能由于添加了多个源导致,首先恢复默认源:
conda config --remove-key channels
然后添加所要安装的镜像源,例如安装pytorch:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
最后复制pytorch官网https://pytorch.org/get-started/locally/的指令
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
注意删除 -c pytorch,然后就可以利用清华镜像源快速下载了。