scipy.misc模块没有属性imread? [英] scipy.misc module has no attribute imread?

查看:2754
本文介绍了scipy.misc模块没有属性imread?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用scipy阅读图像。但是它不接受 scipy.misc.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:\Python27\lib\site-packages\scipy\misc\__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'


推荐答案

您需要安装 PIL 。来自文档 scipy.misc


请注意,Python影像库(PIL)不是SciPy的依赖,因此pilutil模块不是在没有安装PIL的系统上可用。

Note that the Python Imaging Library (PIL) is not a dependency of SciPy and therefore the pilutil module is not available on systems that don’t have PIL installed.

安装PIL后,我可以访问 imread 如下:

After installing PIL, 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆