当前位置:网站首页>win系统下pytorch深度学习环境安装
win系统下pytorch深度学习环境安装
2022-08-10 21:40:00 【七月的和弦】
摘要
系统重装了,整理一下基于pytorch深度学习环境安装的流程。nvidia显卡是必须的。
步骤
1. 所需安装内容
- Anaconda :用来创建工程所需的python环境
- CUDA Toolkit :通用并行计算工具包
- cudnn :用于深度神经网络的GPU加速库
2. 安装
2.1 Anaconda安装
Anaconda官网,下载并找一个合适的位置安装。(除了加入环境变量那一步要打个勾,其他一路下一步)
安装完之后,为了以后第三方包的快速安装,要做2件事
- 更换pip源
- 首先在文件管理器中输入
%APPDATA%
- 新建一个pip文件夹,在该文件夹下,建立一个pip.ini文件
- pip.ini文件内输入
[global]
timeout = 100
index-url =http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
- 更换conda源
1.先在终端输入这条指令
conda config --set show_channel_urls yes
2. 在c:\用户\你的windows账户
下找到.condarc文件,进行编辑
3. 对.condarc文件进行编辑
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true
此时可以先创建一个python环境,用于之后的深度学习使用
- 在cmd中输入
conda create -n Torch python=3.7
,可以创建一个名为Torch,python版本为3.7的环境
2.2 Cuda Toolkit安装
Cuda Toolkit官网,由于当前pytorch官网只提供11.x版本以后的安装命令了,所以我使用cuda11.6的,官网提供了3个link,我选了最新的11.6.2的
就在C盘安装即可,毕竟跟驱动有关系。
之后就顺着安装即可。那个standrad和custom的选项选择custom安装的。
安装完之后,打开命令行,使用nvcc -V
和nvidia-smi
这两个命令,看看有没有毛病
看到这个界面说明安装成功。
2.3 Cudnn安装
为了不出问题,这里使用paddle给的一个安装标准,选择cudnn v8.4.0
cudnn驱动官网,选择cudnn v8.4.0进行下载
将cudnn压缩包内的3个文件夹copy到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6
中,覆盖原来的文件。
2.4 配置环境
- 刚刚第一步使用
conda create -n Torch python=3.7
创建了一个名为Torch的python环境 - 现在使用
conda activate Torch
进入到Torch这个环境 - 进入pytorch官网,复制对应的命令,粘贴到命令行中(如果是搞图像的,可以把torchaudio这个要安装的包删掉,只保留torch和torchvision,还能节省点空间和时间。)
- 安装之后,继续在命令输入python,进行一段简单的代码测试:创建一个随机tensor,送入cuda中,如果成功,那么会出现类似下图的结果。
边栏推荐
- A shell script the for loop statements, while statement
- QT笔记——用VS + qt 生成dll 和 调用生成的dll
- 谁是边缘计算服务的采购者?是这六个关键角色
- shell编程之免交互
- Service - DHCP principle and configuration
- 《mysql 从入门到内卷再到入土》——Mysql基础 学习笔记目录
- 基于Pix4Dmapper的空间三维模型重建应用——空间分析选址
- 元宇宙社交应用,靠什么吸引用户「为爱发电」?
- Redis Performance Impact - Asynchronous Mechanisms and Response Latency
- GAN CFOP
猜你喜欢
A shell script the for loop statements, while statement
从斐波那契 - 谈及动态规划 - 优化
c语言之 练习题1 大贤者福尔:魔法数,神奇的等式
xshell (sed command)
【PCBA方案设计】蓝牙跳绳方案
LeetCode-402 - Remove K digits
Shell 编程--Sed
[Maui official version] Create a cross-platform Maui program, as well as the implementation and demonstration of dependency injection and MVVM two-way binding
什么是Jmeter?Jmeter使用的原理步骤是什么?
JVM经典五十问,这下面试稳了
随机推荐
HighTec快捷键(Keys)设置位置
[SQL brush questions] Day3----Special exercises for common functions that SQL must know
深度学习之 12 循环神经网络RNN2
这些不可不知的JVM知识,我都用思维导图整理好了
Service - DNS forward and reverse domain name resolution service
美味石井饭菜
Huawei router clock near the drainage experiment (using stream strategy)
Shell编程规范与变量
特别的三杯鸡
shell(文本打印工具awk)
Why general company will say "go back messages such as" after the end of the interview, rather than just tell the interviewer the result?
谁是边缘计算服务的采购者?是这六个关键角色
Translating scientific and technological papers, how to translate from Russian to Chinese
HighTec shortcut keys (Keys) setting location
FPGA - 7系列 FPGA内部结构之Memory Resources -03- 内置纠错功能
商家招募电商主播要考虑哪些内容
These must-know JVM knowledge, I have sorted it out with a mind map
ENVI最小距离、最大似然、支持向量机遥感影像分类
Intelligent scheme design - intelligent rope skipping scheme
LeetCode-36-Binary search tree and doubly linked list