当前位置:网站首页>Anaconda中配置PyTorch环境——win10系统(小白包会)
Anaconda中配置PyTorch环境——win10系统(小白包会)
2022-07-05 17:18:00 【时代&信念】
一、背景
最近在跑一个深度学习的代码,需要PyTorch的环境。配置成功后,赶紧总结复盘一些,顺带分享出来!!!
二、前提条件
已经安装好anaconda。
anaconda是什么东东呢?
通俗的来讲就是一个环境管理器,你可以把它想成是一个池子,这个池子里面有各种名称的环境(名称是由你自己定的,用来标识环境就行)。池子中的环境互不干扰,方便咋们用不同的环境跑不同的代码(因为不同的代码,他要求的环境以及版本不一样)
三、配置PyTorch环境过程
1.win10系统下打开终端
(1)快捷键win+R,会弹出以下窗口
(2)输入cmd,点击“确定”
(3)进入win10终端
2.激活anaconda
输入以下命令,进入anaconda的base环境
activate

3. 创建新环境
conda create -n pt python==3.7
pt是我自己起的名字,大家可以自己随意指定。这里python版本我指定了3.7,大家根据自己的需要进行指定就OK。


可以通过以下命令查看当前anaconda已经有的环境
conda env list

4.在新环境下配置PyTorch的环境
(1)查看自己电脑的cuda版本;
方法是:win+R打开电脑终端,输入
nvcc --version

(2)打开PyTorch官网
(3)往下拉找到Previous versions of PyTorch,然后点击
(4)选择和自己电脑cuda适配的命令,进行复制
(5)在anaconda的base环境下激活刚刚创建的新环境pt
(6)将刚刚从pytorch官网复制的命令进行粘贴,然后回车运行


5.在pycharm中设置新环境pt并验证PyTorch环境是否配置成功
(1)打开pycharm,配置新环境pt




找到anaconda安装路径下的环境envs,再找到刚才的新环境pt
找到pt环境下面的python.exe,点击OK



(2)新建脚本,输入以下代码进行测试
import torch
print(torch.__version__)

附录:觉得有帮助的话,记得点赞+收藏+关注!!!文章有不合适的地方,也欢迎各位大佬指正批评!
边栏推荐
- SQL删除重复数据的实例教程
- Alpha conversion from gamma space to linner space under URP (II) -- multi alpha map superposition
- The five most difficult programming languages in the world
- Independent development is a way out for programmers
- Oracle recovery tools -- Oracle database recovery tool
- Force deduction solution summary 729- my schedule I
- c#图文混合,以二进制方式写入数据库
- Domain name resolution, reverse domain name resolution nbtstat
- 毫无章法系列
- 力扣解法汇总729-我的日程安排表 I
猜你喜欢
Summary of optimization scheme for implementing delay queue based on redis

IDEA 项目启动报错 Shorten the command line via JAR manifest or via a classpath file and rerun.
Database design in multi tenant mode

7. Scala class

C # mixed graphics and text, written to the database in binary mode
Example tutorial of SQL deduplication

每日一练:关于日期的一系列

Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP

Short the command line via jar manifest or via a classpath file and rerun

机器学习01:绪论
随机推荐
漫画:寻找无序数组的第k大元素(修订版)
Accuracy of BigDecimal Division
How to modify MySQL fields as self growing fields
MATLAB查阅
C # mixed graphics and text, written to the database in binary mode
Complete solution instance of Oracle shrink table space
漫画:寻找股票买入卖出的最佳时机
MySQL之知识点(七)
Ordinary programmers look at the code, and top programmers look at the trend
Kafaka technology lesson 1
Check the WiFi password connected to your computer
SQL Server(2)
mysql如何使用JSON_EXTRACT()取json值
Knowing that his daughter was molested, the 35 year old man beat the other party to minor injury level 2, and the court decided not to sue
Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!
Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
Cartoon: how to multiply large integers? (next)
机器学习02:模型评估
統計php程序運行時間及設置PHP最長運行時間
Count the running time of PHP program and set the maximum running time of PHP