服务器安装pytorch,亲测可用

现在不用这么复杂了,直接不用换源,直接官网的指令装,什么都不用改

前提:服务器上装了anaconda,conda可用

1、换源

vi ~/.condarc

 shift+i 进入编辑模式

esc 进入命令模式

命令模式下  :wq  保存退出

channels:
  - defaults
show_channel_urls: true
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

remote_read_timeout_secs: 1000.0

2、创建环境

conda create -n pytorch python=3.7

3、查询cuda对应的 pytorch  torchvision torchaudio号

pytorch与torchvision版本对应_pytorch对应的torchvision版本-CSDN博客

去pytorch官网查询Previous PyTorch Versions | PyTorch

查到对应号之后

conda install pytorch==1.10.2 torchvision==0.11.3 torchaudio==0.10.2 cudatoolkit=10.2 -c http://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/linux-64/

其中pytorch  torchvision torchaudio cuda版本号都换成你自己对应的

4、测试

参考:

Index of /anaconda/cloud/pytorch/linux-64/ | 北京外国语大学开源软件镜像站 | BFSU Open Source Mirror

使用conda安装GPU版本的Pytorch_conda安装pytorch gpu版本_jianger513的博客-CSDN博客

在服务器上下载anaconda,配置pytorch的过程 [CUDA11.4],以及使用pychram连接服务器_服务器下载pytorch_Abigail61的博客-CSDN博客

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值