scipy缺少ndimage

dav*_*nal 24 python scipy

我正在尝试使用来自scipy的ndimage库,但它显然是缺失的.我从numpy和scipy都运行了测试,结果还可以.我正在使用numpy 1.6.1和scipy 0.10.0从sourceforge上的官方软件包安装.

运行

import numpy
import scipy
import pprint

print(scipy.version.version)
print(numpy.version.version)

img = scipy.ndimage.imread("")
Run Code Online (Sandbox Code Playgroud)

0.10.0
1.6.1
Traceback (most recent call last):
  File "extract.py", line 8, in <module>
    img = scipy.ndimage.imread("")
AttributeError: 'module' object has no attribute 'ndimage'
Run Code Online (Sandbox Code Playgroud)

dav*_*nal 41

您必须导入模块:

import scipy.ndimage
Run Code Online (Sandbox Code Playgroud)


小智 9

模块应该像这样导入:

from  scipy import ndimage
Run Code Online (Sandbox Code Playgroud)