pytorch+Anaconda+python3.10+parcharm+win10安装简化教程

Pytorch+Anaconda+Python3.10+parcharm+WIN10安装简化教程

pycharm的安装

1、首先登陆pycharm官网,https://www.jetbrains.com/pycharm/download/
2、下载community版本
在这里插入图片描述
3、下载完成后,双击安装,一直点下一步。
在这里插入图片描述

Anaconda的安装

1、首先登录anaconda官网,https://www.anaconda.com/
2、点击Download下载安装包
在这里插入图片描述
3、双击安装包安装,选择Just Me
4、更换路径,不是C盘就行
5、勾选两个选项框,安装。
在这里插入图片描述
在这里插入图片描述
6、wait a minute,安装完成。

Python的安装

1、输入网址python.org,点击downloads,all releases,然后点击windows,最后选择3.10.10版本,64位。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2、双击exe文件进行安装,勾选这两个选项;然后安装;
在这里插入图片描述

Pytorch的安装

1、在开始菜单中找到Anaconda Prompt,右键管理员打开(这里必须要管理员)
2、默认进入base环境
在这里插入图片描述
3、修改清华源下载路径

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
conda config --set show_channel_urls yes
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64

4、创建pytorch虚拟环境,在base环境下,输入以下代码;(pytorch为环境名)

conda create -n pytorch

然后激活虚拟环境

conda activate pytorch

5、不关闭Anaconda Prompt,打开浏览器打开网址https://pytorch.org/get-started/previous-versions/;选择需要的torch版本;比如说你的cuda版本为11.3,你选择11.3对应的pytorch版本;但是注意粘贴到的网站需要删除掉-c pytorch;(多次亲测使用pip安装比较稳定一些,conda安装老是丢东西 #2024.3.18)
在这里插入图片描述

conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3

在这里插入图片描述

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

6、将复制的指令放入刚才未关闭的Anaconda Prompt中,等待安装成功;(途中需要输入“y”来继续安装)

7、不要关闭Anaconda Prompt界面,分别输入以下指令

conda --version
activate
python

在这里插入图片描述
不报错为安装成功;

parcharm环境配置

1、在python、Anaconda、pytorch、parcharm安装完毕后,需要打开parcharm配置环境;
2、点击左上角File,New Project;
在这里插入图片描述

3、自定义项目位置Location,然后选择Previously configured interpreter,点击Add Interpereter,点击Add Local Interpreter
在这里插入图片描述

在这里插入图片描述
4、选择conda Environment,选择anaconda3安装路径下的Scripts文件夹下的conda.exe文件;然后点击Load Environments;
选择Use existing environment,选择以下环境;点击OK(注:因为我们没有创建虚拟环境,所以环境在这个路径下)
在这里插入图片描述

5、配置完成后,点击File,Settings,Project:…,python Interpreter,确认里面的pytorch安装包,到此安装完成
在这里插入图片描述
6、验证环境配置是否正确,在parcharm中输入以下代码。运行后出现以下内容即为环境配置完成。

import torch
import numpy as np
arr=np.ones((3,3))
print("arr的数据类型为:"+str(arr.dtype))
t=torch.tensor(arr)
print(t)

在这里插入图片描述
在这里插入图片描述

*#*安装好的小伙伴们,记得一键三连哦!!!谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Dakchueng

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

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

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

打赏作者

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

抵扣说明:

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

余额充值