win10环境下安装pytorch-cpu版

开发环境:

win10 x64位

anaconda3-4.0.0

虚拟环境python版本 3.6.5(安装过程中根据你安装的pytorch版本可能需要升级)

前提:anaconda已配置好环境变量,使用conda切换到需要安装pytorch的虚拟环境。

第一步:anaconda改为国内源(如果已经改过,请检查添加的国内源中是否有pytorch的源(下方代码中倒数第二行),如果没有请添加国内pytorch源)

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/conda-forge/ 
 
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/peterjc123/
 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
 
conda config --set show_channel_urls yes

第二步:搜索可用版本

conda search pytorch-cpu

执行结果:(因为时间不一样可能会有新的版本发布,所以搜索结果可能也不一样)
在这里插入图片描述

从搜索结果可以看到,共搜索到0.4.0、0.4.1、1.0.0、1.1.0四个版本,但并不是版本越高越好,版本越高可能稳定性越差(猜测),所以尽量找中间版本或者根据需要进行安装,这里我选择安装0.4.1版本。

第三步:安装

# 先安装pytorch-cpu
conda install pytorch-cpu=0.4.1
 
# 然后安装依赖torchvision-cpu,这里不需要指定版本
conda install torchvision-cpu

运行结果:(视网速,安装过程有快有慢,耐心多等待一会)

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

全程无报错,到此,安装就算完成了。

最后,验证:

在这里插入图片描述

导入无报错,安装成功。

————————————————
版权声明:本文为CSDN博主「乌拉队长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/asdfg6541/article/details/104508468

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值