How to install PyTorch

  1. enter anaconda base

  2. conda create -n PyTorch python=3.9
    创建一个 python 的虚拟环境, PyTorch 是环境变量名(可以是任意英文)

Next time, you can activate this virtual environment directly.

Remark: conda env remove -n ***(PyTorch)

  1. conda activate PyTorch 激活虚拟环境

(base) \to (PyTorch) (开发环境)

  1. 进入官网根据配置选择安装 GPU or CPU, 在(PyTorch) 环境下 run the command.

Remark: GPU only NVIDIA under Windows,

  1. type ‘python’, ‘import torch’

conda list -n env1 查看env1 list

conda install -n env1 numpy /install numpy at env1