1、添加清华镜像源
依次输入以下命令:
conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config –set show_channel_urls yes
2、查看镜像源
conda config –show channels
3、遇到的bug
在安装pytorch时发现错误
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url
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://mirros.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64’
4、问题解决
使用conda config –remove -key channels指令换回默认源
再次添加新清华镜像源
再次安装pytorch失败
最终妥协使用使用conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch安装成功,应该是清华镜像源没有这个版本的pytorch,他会从清华园下载有的,然后从pytorch官网下载没有torch
Original: https://blog.csdn.net/xmhsq888888/article/details/125283896
Author: 一颗小番茄lh
Title: Linux服务器安装pytorch更换conda清华镜像源
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/770684/
转载文章受原作者版权保护。转载请注明原作者出处!