环境配置conda

配置清华镜像源:

# 添加清华Anaconda镜像
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
# 设置ssl_verify为false,可以规避SSL报错
conda config --set ssl_verify false

也可以直接在.condrac文件里直接修改,文件路径为C:\Users\XXX(你的用户名)

pytorch1.7.1+cuda10.1+torchvision0.8.2

conda install cudatoolkit==10.1
conda install pytorch==1.7.1
conda install torchvision==0.8.2
conda install torchaudio==0.7.2

最后下载的是这个(都是python3.9的):

验证pytorch(gpu版)是否安装成功

python
import torch
torch.cuda.is_available()

结果为true,安装完成。

如果为false, print(torch.__version__),若为1.7.1+cpu,则安装的是cpu版的pytorch.需要重新安装pytorch,推荐看https://blog.csdn.net/qq_46126258/article/details/112708781

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值