scipy.misc 模块没有属性 imread? [英] scipy.misc module has no attribute imread?
本文介绍了scipy.misc 模块没有属性 imread?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 scipy 读取图像.但是它不接受 scipy.misc.imread
部分.这可能是什么原因?
解决方案
您需要安装 Pillow(以前PIL).来自 scipy.misc
上的 文档:
请注意 Pillow 不是 SciPy 的依赖项,但没有它,下面列表中指示的图像处理功能将不可用:
...
已读
...
安装 Pillow 后,我可以访问 imread
如下:
在[1]中:导入scipy.misc在 [2]: scipy.misc.imread输出[2]:<函数scipy.misc.pilutil.imread>
I am trying to read an image with scipy. However it does not accept the scipy.misc.imread
part. What could be the cause of this?
>>> import scipy
>>> scipy.misc
<module 'scipy.misc' from 'C:Python27libsite-packagesscipymisc\__init__.pyc'>
>>> scipy.misc.imread('test.tif')
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
scipy.misc.imread('test.tif')
AttributeError: 'module' object has no attribute 'imread'
解决方案
You need to install Pillow (formerly PIL). From the docs on scipy.misc
:
Note that Pillow is not a dependency of SciPy but the image manipulation functions indicated in the list below are not available without it:
...
imread
...
After installing Pillow, I was able to access imread
as follows:
In [1]: import scipy.misc
In [2]: scipy.misc.imread
Out[2]: <function scipy.misc.pilutil.imread>
这篇关于scipy.misc 模块没有属性 imread?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文