当前位置:网站首页>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__)

附录:觉得有帮助的话,记得点赞+收藏+关注!!!文章有不合适的地方,也欢迎各位大佬指正批评!
边栏推荐
- c#图文混合,以二进制方式写入数据库
- Matery主题自定义(一)黑夜模式
- In depth understanding of redis memory obsolescence strategy
- 一文读懂简单查询代价估算
- ICML 2022 | meta proposes a robust multi-objective Bayesian optimization method to effectively deal with input noise
- Is it safe for China Galaxy Securities to open an account? How long can I buy stocks after opening an account
- 漏洞复现----48、Airflow dag中的命令注入(CVE-2020-11978)
- Please tell me why some tables can find data by writing SQL, but they can't be found in the data map, and the table structure can't be found
- 独立开发,不失为程序员的一条出路
- Beijing internal promotion | the machine learning group of Microsoft Research Asia recruits full-time researchers in nlp/ speech synthesis and other directions
猜你喜欢

MySQL之知识点(七)

C # mixed graphics and text, written to the database in binary mode

Kafaka technology lesson 1
一文了解MySQL事务隔离级别

MySQL之知识点(六)

統計php程序運行時間及設置PHP最長運行時間

Seven Devops practices to improve application performance

7. Scala class

十个顶级自动化和编排工具

Winedt common shortcut key modify shortcut key latex compile button
随机推荐
为什么阳历中平年二月是28天
Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!
Force deduction solution summary 1200 minimum absolute difference
VBA drives SAP GUI to realize office automation (II): judge whether elements exist
机器学习01:绪论
网络威胁分析师应该具备的十种能力
Cartoon: looking for the k-th element of an unordered array (Revised)
Kafaka技术第一课
漫画:如何实现大整数相乘?(整合版)
leetcode每日一题:字符串中的第一个唯一字符
求解为啥all(())是True, 而any(())是FALSE?
BigDecimal除法的精度问题
一文了解MySQL事务隔离级别
排错-关于clion not found visual studio 的问题
查看自己电脑连接过的WiFi密码
In depth understanding of redis memory obsolescence strategy
Understand the usage of functions and methods in go language
Humi analysis: the integrated application of industrial Internet identity analysis and enterprise information system
Flow characteristics of kitchen knife, ant sword, ice scorpion and Godzilla
Flask solves the problem of CORS err