pytorch安装(windows)

(1)下载pycharm

PyCharm: the Python IDE for Professional Developers by JetBrains

(2)下载anaconda

Anaconda | The World's Most Popular Data Science Platform

(3)创建一个新环境:torch

conda create -n torch -y

(4)进入新环境

conda activate torch

(5)加入清华源

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/

(6)安装pytorch

conda install pytorch torchvision torchaudio cudatoolkit=11.3 pytorch

(7)判断GPU是否可用

import torch
print(torch.cuda.is_available())
True
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Windows安装PyTorch,你可以按照以下步骤进行操作: 1. 首先,确保你安装了Anaconda3。如果你想使用GPU进行训练,还需要先安装CUDA和cudnn等驱动程序和配置。 2. 创建一个新的Anaconda环境,并激活它。你可以使用以下命令: ``` conda create -n torch conda activate torch ``` 3. 配置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/ ``` 或者你也可以手动修改C盘下的用户文件夹中的.condarc文件,将"https"改为"http",并删除-default。 4. 查询你的电脑所适用的PyTorch CUDA版本。根据你的显卡型号和CUDA版本选择正确的PyTorch版本。 5. 从PyTorch官网下载适用于你的电脑的PyTorch安装包。 6. 安装PyTorch。你可以使用Anaconda进行安装,运行以下命令: ``` conda install pytorch torchvision torchaudio cudatoolkit=xx.x -c pytorch ``` 其中,xx.x表示你查询到的适用的CUDA版本。 7. 安装完成后,你可以进行测试以确保PyTorch成功安装。你可以尝试运行以下命令在Python环境中导入PyTorch并打印版本信息: ``` import torch print(torch.__version__) ``` 这样就完成了在Windows安装PyTorch的过程。希望这些步骤能帮助到你。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [WindowsPytorch安装全过程](https://blog.csdn.net/weixin_43976737/article/details/121440865)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [Pytorch安装windows)](https://blog.csdn.net/m0_57368670/article/details/129125656)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值