ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'

原因:

torchvision 版本太高 

解决方案:

https://blog.csdn.net/Lee_lg/article/details/103901632

 

在Anaconda中使用命令行conda install torchvision 安装了torchvision模块。安装成功

在spyder中运行 import torchvision,报错,如下:

 

 

 

 报错解释:torchvision在运行时要调用PIL模块,调用PIL模块的PILLOW_VERSION函数。但是PILLOW_VERSION在Pillow 7.0.0之后的版本被移除了,Pillow 7.0.0之后的版本使用__version__函数代替PILLOW_VERSION函数。

打开报错提示中的文件路径C:\Users\Public\Anaconda3\Lib\site-packages\PIL,打开__init__.py文件就可以看到如下解释:
————————————————

posted @ 2020-04-24 16:35  月夜_1  阅读(1600)  评论(0编辑  收藏  举报