win10用Anaconda安装pytorch

本文详细介绍了如何使用Anaconda和清华镜像源在Windows环境下安装PyTorch及其依赖包,包括设置系统路径、配置conda镜像源、安装PyTorch和验证安装过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先安装Anaconda:

采用清华镜像下载。网址:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

这里在最后一行选择 Anaconda3-5.1.0-Windows-x86_64.exe 版。

勾选add Anaconda进入系统路径,这样才能用conda命令

 

然后开始安装pytorch:

首先进入 Pytorch 官网: https://pytorch.org/

按配置选中,得到命令:

但为了使用清华源,需要把-c pytorch取掉,所以命令为:

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 --set show_channel_urls yes


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


conda install pytorch torchvision cudatoolkit=10.0

注意cmd需要用管理员权限打开,否则会报错ERROR conda.core.link:_execute(481): An error occurred while uninstalling pa...

然后验证安装是否成功:

python

import torch

然后还要在pycharm中添加新的interpreter:

在这个环境下才有torch可用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值