Python 3.6,调用scipy报错如下:
from scipy.misc import imread
ImportError: cannot import name 'imread'
查询网上各种资料以及自己实践后发现,终于解决问题,主要有如下三种可能性:
- pillow未安装
->>>经检查发现已安装,排除
pip install pillow
>>> Requirement already satisfied #已完成安装
- scipy和pillow不在同一个文件下
->>>经检查发现在同一个目录下,排除
Requirement already satisfied: scipy in c:\python\python36\lib\site-packages (1.4.1)
Requirement already satisfied: numpy>=1.13.3 in c:\python\python36\lib\site-packages (from scipy) (1.18.1)
WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\python\python36\python.exe -m pip install --upgrade pip' command.
Requirement already satisfied: pillow in c:\python\python36\lib\site-packages (7.0.0)```
- scipy版本太高,无法兼容,需要降低版本
->>>经测试可行
pip uninstall scipy # 先卸载之前版本的scipy
pip install scipy==1.2.1 # 卸载成功后安装1.2.1版本的scipy
搞定!终于不再报错了!