解决 ImportError: cannot import name imsave 的报错问题
2017-09-13 21:49
5512 查看
如果你要使用 scipy.misc.imsave等图像文件操作函数,那么实际上需要导入Pillow。但是 scipy安装文件并没有把这个依赖写进来(比如Mac),所以如果你的系统中没有安装Pillow,在执行下面的语句时会出错:
报的错误是:
使用下面的命令安装:
另外:输入以下命令可以看导入的 scipy 文件夹里面都有哪些能被识别出的module
这两种语句是不同的,scipy里没有imsave等,而安装了Pillow的scipy.misc里有。
from scipy.misc import imread, imsave, imresize
报的错误是:
>>> from scipy.misc import imsave Traceback (most recent call last): File " < stdin > ", line 1, in <module> ImportError: cannot import name imsave
使用下面的命令安装:
pip install numpy pip install scipy pip install matplotlib pip install Pillow
另外:输入以下命令可以看导入的 scipy 文件夹里面都有哪些能被识别出的module
import scipy dir(scipy)
import scipy.misc dir(scipy.misc)
这两种语句是不同的,scipy里没有imsave等,而安装了Pillow的scipy.misc里有。
相关文章推荐
- ImportError: cannot import name ABCMeta 问题解决
- Python2下ImportError: cannot import name 'urlopen'问题解决
- 解决ImportError:cannot import name xmlrpc_client问题
- python MySQLdb ImportError: cannot import name conversions 解决办法
- [Django]ImportError:cannot import name debug问题
- 解决ImportError: cannot import name webdriver
- [Django]ImportError:cannot import name debug问题
- [Django]ImportError:cannot import name debug问题
- 如何解决ImportError: cannot import name BeautifulSoup 或者 ImportError: No module named BeautifulSoup
- 解决ImportError: cannot import name HTTPConnection的方法
- ImportError: cannot import name pinvh问题解决
- 解决bs4在Python 3.5下出现“ImportError: cannot import name 'HTMLParseError'”错误
- 解决ImportError: cannot import name xxx
- 小记:解决问题ImportError: cannot import name symbol_database
- [Django]ImportError:cannot import name debug问题
- 解决bs4在Python 3.6下出现“ImportError: cannot import name 'HTMLParseError'”错误
- 解决ImportError: cannot import name HTTPSHandler
- 解决问题:ImportError: cannot import name MAXREPEAT
- 安装comtypes 0.6.2时ImportError: cannot import name DistutilsOptionError 解决办法
- 解决ImportError: cannot import name webdriver