首页 > 其他分享 >安装pytorch(torch)

安装pytorch(torch)

时间:2024-07-20 10:55:28浏览次数:18  
标签:cn mirrors torch anaconda pytorch tsinghua https edu 安装

建议换源,可以下载速度很快,这里使用的是清华源

需要GPU训练,如果没有,自行选择英伟达版本下载

修改源,C盘——>user(用户)——>个人用户(自己命名的用户名),找到.condarc,用记事本打开,修改为:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/

具体想了解的查看https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

打开PyTorch,找到:

在这里插入图片描述

根据自己设备和解释器,自行选择对应选项

复制命令行,如:

在这里插入图片描述

win + r ,——> cmd,运行代码

在这里插入图片描述

安装成功后,测试运行,这里选用的是pyharm

import torch    # 导入PyTorch库
print(torch.__version__)    # 打印PyTorch的版本号
print(torch.version.cuda)   # 打印PyTorch所使用的CUDA版本号【注意:如果PyTorch未使用CUDA或者CUDA不可用,这将返回None】

标签:cn,mirrors,torch,anaconda,pytorch,tsinghua,https,edu,安装
From: https://blog.csdn.net/weixin_64534587/article/details/140567029

相关文章

  • PyTorch 中 nn.Conv2d()
    nn.Conv2d() 是PyTorch中用于定义二维卷积层(Convolutionallayer)的函数,它属于 torch.nn 模块,该模块包含了构建神经网络所需的所有构建块。二维卷积层是卷积神经网络(CNN)中最基本也是最重要的组件之一,广泛用于图像和视频处理、自然语言处理等领域。nn.Conv2d() 函数的基本语......
  • TeX Live 安装
    Ubuntusudoaptinstalltexlive-full其他可用软件包:软件包压缩包磁盘空间texlive-latex-base59MB216MBtexlive-latex-recommended74MB248MBtexlive-pictures83MB277MBtexlive-fonts-recommended83MB281MBtexlive98MB314MBtexli......
  • PyTorch 中 loss.grad_fn 解释
    在PyTorch中,loss.grad_fn属性是用来访问与loss张量相关联的梯度函数的。这个属性主要出现在使用自动微分(automaticdifferentiation)时,特别是在构建和训练神经网络的过程中。当你构建一个计算图(computationalgraph)时,PyTorch会跟踪所有参与计算的操作(比如加法、乘法、激活函数等),......
  • Vue常用组件安装命令合集
    qs是一个流行的查询参数序列化和解析库。可以将一个普通的object序列化成一个查询字符串,或者反过来将一个查询字符串解析成一个object,帮助我们查询字符串解析和序列化字符串。npminstallqsnpminstallaxios-Selementuiui组件库npmielement-ui-Snpmielement-ui@2......
  • Python和pycharm的环境安装
    1.Python的安装方法一、Python的官网下载地址:https://www.python.org/downloads/   下载安装方法二、anaconda安装(开源的Python发行版本)下载版本列表:https://repo.anaconda.com/archive/重要说明:如果你下载最近版本安装的过程中出现:failedtoextractpackages弹窗提......
  • Redis在CentoOS上安装
    一、下载https://download.redis.io/releases/ (版本为6.2.6)二、解压mkdir/usr/local/redistar-zxvfredis-6.2.6.tar.gz-C/usr/local/redis三、编译1、检查是否安装了gcc依赖(若已经安装,无需再次安装)gcc-v2、若没有安装gcc依赖,需要安装gcc依赖yuminstall-......
  • 深入Redis集群部署:从安装配置到测试验证的完整指南
      ......
  • k8s 集群安装
    决定重新搭建一个k8s集群,记录一下过程。本次使用三台主机,分别是master节点和两个worker节点。主机配置统一如下:配置项配置OSUbuntu22.04.4LTSx86_64Kernel5.15.0-102-genericCPUAMDRyzen75700X(16)@3.399GHzMemory8GDisk100GClust......
  • PVE安装windows7
    ProxmoxVEpve安装win7系统,安装Windows10和Windows11也是一样的流程/设置朗读全文Yourbrowserdoesnotsupporttheaudioelement.有什么用分享整个PVE重新安装Windows7的过程J4125已经有Window2008了,用来承载服务端应用还是妥妥的;可是最近搞硬件,CH341A土豪金24/25......
  • 电脑windows7系统环境Framework 4.6.2无法安装的解决方法
    一、错误1、尚未安装.net4.6,无法建立到信任根颁发机构的证书链的错误2、出现错误的原因:在安装Microsoft.NETFramework4.6.2脱机包时提示无法建立到信任根颁发机构的证书链二、解决方法1、实际上是要安装一个根证书MicrosoftRootCertificateAuthority2011.cer2、开始......