【环境配置】虚拟环境配置

创建虚拟环境

conda create -n pytorch python=3.9

【环境配置】虚拟环境配置_第1张图片
安装成功提示
【环境配置】虚拟环境配置_第2张图片
激活虚拟环境

activate pytorch

在这里插入图片描述

安装pytorch

查看 python 版本——python
退出 python——exit()
在这里插入图片描述
对照 python 与 pytorch 的对应关系
【环境配置】虚拟环境配置_第3张图片
pytorch 地址:

https://pytorch.org/get-started/previous-versions/

安装

conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cpuonly -c pytorch

验证是否安装成功
打开 python

import torch
print(torch.__version__)
exit()

【环境配置】虚拟环境配置_第4张图片

安装spyder

安装

pip install spyder 

【环境配置】虚拟环境配置_第5张图片

运行

spyder

【环境配置】虚拟环境配置_第6张图片

conda相关指令

查看电脑上所有已创建的环境

conda info --env

删除不需要的环境

conda remove -n 环境名 --all

查看当前环境中所有已安装的包

conda list

你可能感兴趣的:(python,pytorch,conda,环境配置,spyder)