Windows11+cuda10.0+Pytorch安装(附文件下载链接)

背景

由于windows11刚出,想体验一下简约清爽的界面,一头热就升级到windows11了,用了大概一个月突然发现太卡了,没有windows10的体验感,想换回去,于是在网上找教程,发现了下图(挺秃然的):
在这里插入图片描述

​ 好家伙,居然被Microsoft安排了一波。不想重装系统的我就姑且忍受这暂时的卡顿吧,相信微软会改进这一点的(起码在UI界面的设计方面还是有很大的提升的)。突然,今天上机器学习的实验课的时候,老师让我们在自己的电脑上搭建pytorch环境,我想着之前windows10遗留下的GPU版本的pytorch的任务没完成,今天就把这个待解"问题"完成一下。

真正的背景

希望能够帮助更多的朋友减少搭建环境的时间,更快地投入开发。接下来就是真正地搭建环境了,我的硬件为:联想拯救者R7000,GPU的版本为:GTX1650;软件为:anaconda、pycharm、python3.7版本

步骤

  1. 安装对应版本的CUDA
  2. 安装CUDA对应的CUDNN
  3. 安装对应CUDA、python版本对应的torch
  4. 安装torch对应的torchvision

具体实现

1.安装对应版本的CUDA
1.1.查看自己的CUDA的版本
  • 打开NVIDIA Control Panel,点击系统信息
    在这里插入图片描述

  • 点击组件,查看到自己的CUDA最高的版本,当然如果安装低于这个版本的CUDA也是可以的,但是注意不能安装高于这个版本的CUDA哦

在这里插入图片描述

1.2 下载并安装CUDA
  • 官网找到合适的版本下载,官网链接:https://developer.nvidia.com/cuda-toolkit-archive
    在这里插入图片描述在这里插入图片描述

  • 安装CUDA

    下载后点击exe文件开始安装

    这里我们选择默认的位置就行,之后就等待安装完成即可
    在这里插入图片描述

    选择安装选项

    在这里插入图片描述

    等待安装成功

    在这里插入图片描述

    注:若安装过程中出现失败的情况,可以重新安装一下或者降低一下cuda的版本,之前我就是安装cuda11.6安装一直失败,然后改变为cuda10.0就成功了

1.3 验证CUDA

​ 通过cmd打开命令终端,输入nvcc -V
在这里插入图片描述

​ 如果没有出现问题,到这里我们的cuda就安装完成了!当然,俗话说"常在河边走,哪有不湿鞋",万一出现了如下情况:

在这里插入图片描述

​ 内心肯定在想:咋又错了呢?我都是按照步骤来的呀!不要急,看看我们的环境变量,很有可能是它的问题!

​ 打开我们的系统变量:
在这里插入图片描述

在这里插入图片描述

​ 再去输入nvcc -V就可以了

2.安装CUDA对应的CUDNN
2.1 找到cuda对应的cudnn的版本

​ 可以去官网上找到cuda对应的cudnn

在这里插入图片描述

注意:这里cuda和cudnn的版本一定要对应!!!

2.2. cudnn下载
  • 官网链接:https://developer.nvidia.com/rdp/cudnn-download

​ 注:第一次进入官网的时候要进行注册登录才可以正常地下载哦

  • 解压下载的zip压缩包,将解压后文件夹复制到如下图的指定的位置

在这里插入图片描述

​ 到这里,我们的cudnn就成功安装成功了!!

3.安装对应CUDA、python版本对应的torch
3.1 找到对应的torch的whl文件

这里由于pytorch官网没有写cuda10.0的下载命令,而且官网下载较为慢,所以我们直接下载whl文件进行安装

首先将https://download.pytorch.org/whl/torch_stable.html复制到浏览器里打开包下载界面。找到对应的文件:

在这里插入图片描述

解释:cu100:代表的是cuda的版本号为10.0;cp37:代表的是python的版本为3.7;win_amd64:代表的是选择的是windows x64位的操作系统;torch-1.2.0:代表的是pytorch的版本为1.2.0(注意:python版本号代表着我们必须使用的是python3.7版本的虚拟环境,不能使用其它版本的,否则会报错

3.2 安装torch

在这里插入图片描述

3.3 验证torch是否安装成功

进入pycharm的终端控制台:
在这里插入图片描述

验证torch:

在这里插入图片描述

到此,我们的torch也就安装成功了!!!

4.安装torch对应的torchvision
4.1 找到对应的torchvision的whl文件

​ 首先将https://download.pytorch.org/whl/torch_stable.html复制到浏览器里打开包下载界面。找到对应的文件:
在这里插入图片描述

4.2 安装torchvision

在这里插入图片描述

4.3 验证torchvision是否安装成功

在这里插入图片描述

​ 至此,我们就成功地搭建好win11下的GPU版本的pytorch环境了,接下来就可以利用GPU这把武器去闯关机器学习、深度学习等等高阶领域啦!!!!

附:为了让大家避免下载速度过慢以及卡在官网转圈圈的界面,特地将上面需要的文件以及压缩包上传到百度网盘上供大家使用哈

链接:https://pan.baidu.com/s/1k3y-mTgFoPsoJkBFuL52RQ
提取码:PZS6

  • 41
    点赞
  • 96
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论
自编译tensorflow: 1.python3.5,tensorflow1.12; 2.支持cuda10.0,cudnn7.3.1,TensorRT-5.0.2.6-cuda10.0-cudnn7.3; 3.支持mkl,无MPI; 软硬件硬件环境:Ubuntu16.04,GeForce GTX 1080 配置信息: hp@dla:~/work/ts_compile/tensorflow$ ./configure WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown". You have bazel 0.19.1 installed. Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3 Found possible Python library paths: /usr/local/lib/python3.5/dist-packages /usr/lib/python3/dist-packages Please input the desired Python library path to use. Default is [/usr/local/lib/python3.5/dist-packages] Do you wish to build TensorFlow with XLA JIT support? [Y/n]: XLA JIT support will be enabled for TensorFlow. Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: No OpenCL SYCL support will be enabled for TensorFlow. Do you wish to build TensorFlow with ROCm support? [y/N]: No ROCm support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: y CUDA support will be enabled for TensorFlow. Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10.0]: Please specify the location where CUDA 10.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-10.0 Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]: 7.3.1 Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-10.0]: Do you wish to build TensorFlow with TensorRT support? [y/N]: y TensorRT support will be enabled for TensorFlow. Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]:/home/hp/bin/TensorRT-5.0.2.6-cuda10.0-cudnn7.3/targets/x86_64-linux-gnu Please specify the locally installed NCCL version you want to use. [Default is to use https://github.com/nvidia/nccl]: Please specify a list of comma-separated Cuda compute capabilities you want to build with. You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 6.1,6.1,6.1]: Do you want to use clang as CUDA compiler? [y/N]: nvcc will be used as CUDA compiler. Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: Do you wish to build TensorFlow with MPI support? [y/N]: No MPI support will be enabled for TensorFlow. Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: Not configuring the WORKSPACE for Android builds. Preconfigured Bazel build configs. You can use any of the below by adding "--config=" to your build command. See .bazelrc for more details. --config=mkl # Build with MKL support. --config=monolithic # Config for mostly static monolithic build. --config=gdr # Build with GDR support. --config=verbs # Build with libverbs support. --config=ngraph # Build with Intel nGraph support. --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects. Preconfigured Bazel build configs to DISABLE default on features: --config=noaws # Disable AWS S3 filesystem support. --config=nogcp # Disable GCP support. --config=nohdfs # Disable HDFS support. --config=noignite # Disable Apacha Ignite support. --config=nokafka # Disable Apache Kafka support. --config=nonccl # Disable NVIDIA NCCL support. Configuration finished 编译: hp@dla:~/work/ts_compile/tensorflow$ bazel build --config=opt --config=mkl --verbose_failures //tensorflow/tools/pip_package:build_pip_package 卸载已有tensorflow: hp@dla:~/temp$ sudo pip3 uninstall tensorflow 安装自己编译的成果: hp@dla:~/temp$ sudo pip3 install tensorflow-1.12.0-cp35-cp35m-linux_x86_64.whl

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风华同学

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值