很久之前在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即可成功导入

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐