Windows10 + Anaconda+Pytorch 安装

本文参考了别人的安装教程,然后做了一些改进。希望大家能够更快,没有bug的装上。

1.先确认自己的显卡信息,就是查看显卡支持的CUDA版本。

英伟达控制面板->帮助->系统信息->组件,如下图所示:

我这里支持的是CUDA11.0版本,要记住,后面要用。现在pytorch最高也直到10.2,它是向下兼容的,所以不用担心。

2.然后安装Anaconda, 这里就不给安装教程了,自己在CSDN上找个连接参考就行了,注意找最新的安装教程。

3.去pytorch网站上复制命令

https://pytorch.org/get-started/locally/

按照上图进行选择,我那个Linux是截图的时候不小心造成的,这里python也没有版本选择了,因为使用的是anaconda。

记住这个命令。

4.打开anaconda prompt命令行

输入命令,创建虚拟环境

conda create --name pytorch python=version,这里使用自己的python版本号

5.进入pytorch虚拟环境

activate pytorch

6.更换镜像源,使用清华镜像源网站下载,不然等会儿要报错,这里提前换上

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/msys2/

 

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/

 

7.然后将pytorch官网上的配置命令粘贴到命令行终端,去掉最后的-c pytorch

回车,等待安装完成即可(中间要输入y哦)

 

8.验证安装是否成功

进入python环境

python

输入命令

import torch
import torchvision

如果没有报错即安装成功

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值