1. 输入命令查询现有的pytorch版本
import torch
print (torch.__version__) (前后都是两个下划线)
- pytorch 0.1.12-py360
- torchvison :0.1.8-py36_2
2. 更新pytorch和pytorchvision
- cpu版本,适用于python2.7-3.6
- MacOS 不支持 CUDA,如果需要CUDA 8,CUDA 9.0,或 CUDA 9.2,则需要从源码编译安装
conda install pytorch torchvision -c pytorch
3. 若是安装过程中报错:ERROR conda.core.link:_execute(502):
An error occurred while uninstalling package 'defaults::numpy-1.11.3-py36_0'. 说明安装失败

- 解决方法,输入以下命令:
sudo conda install pytorch torchvision -c pytorch
然后运行后可以看到安装成功

网友评论