ustroetz ustroetz - 8 months ago 440
Python Question

scipy.misc module has no attribute imread?

I am trying to read an image with scipy. However it does not accept the

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>
AttributeError: 'module' object has no attribute 'imread'


You need to install PIL. From the docs on scipy.misc:

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.

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>