我打开python3解释器并输入
import scipy.misc
scipy.misc.imsave
结果
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'imsave'
名字变了吗?它在python2中工作得很好,但我宁愿不向后迁移。
我在Lubuntu 13.04上安装了Python 3.3.1,所有模块都是从默认存储库下载的。Scipy安装完毕,print(scipy.misc.__doc__)
显示imsave
应该在那里。
编辑:scipy.__version__
给出0.11.0from scipy.misc import imsave
给出
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name imsave
5条答案
按热度按时间e5nqia271#
scipy.misc.imsave
在较新的Scipy版本中已被弃用。将您的代码更改为:
1tu0hz3e2#
或
pip install pillow
,以安装新的PIL实现。这在Python 3.4中运行良好。3gtaxfhh3#
尝试安装Ubuntu软件包
python3-imaging
。PIL(Python Imaging Library)。imsave
(以及scipy.misc
中的其他im*
功能)需要PIL。watbbzwu4#
我也有同样的问题,这个问题的答案没有帮助。我通过安装以前版本的scipy解决了这个问题:
vdgimpew5#
正如以前版本的文档中所指出的,
1.2.0
中不推荐使用该函数。https://docs.scipy.org/doc/scipy-1.1.0/reference/generated/scipy.misc.imsave.html该库的
1.1.0
版本是启用此功能的最后一个版本,可以使用注:此版本代码发布于2018年5月6日