很久之前在ubuntu上配置了pytorch环境,最近在windows系统下重新安装的了pytorch,踩了坑耽误很多时间,现总结如下
import torchvision出错
安装环境:anaconda+pytorch+cuda10.0+cudnn
安装成功后import torch
正常,但是import torchvision
提示报错,其中错误原因是
cannot import name 'PILLOW_VERSION' from 'PIL'
原来是pillow版本过高,在pillow7.0.0中没有’PILLOW_VERSION’,需要降级,
指令
conda uninstall pillow
conda install pillow=6.1
再次import torchvision
即可成功导入