1. 先新建虚拟环境,命名为pytorch,可以命名为自己习惯的名称。
conda create -n pytorch python=3.6
2. 进入该虚拟环境
conda activate pytorch
3. 去官网选择合适版本
pytorch官网:https://pytorch.org/get-started/locally/

conda install pytorch torchvision cpuonly -c pytorch
使用清华源安装:
https://blog.csdn.net/werdery/article/details/104866515
在pycharm里面:File-Settings-Project-project interpreter,然后选中

4. 运行以下代码看看是否已经安装成功:
import torch
import torchvision
print(torch.__version__)
报错:
Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe
解决:
安装VC(https://blog.csdn.net/qq_29750461/article/details/108083764
)
网友评论