scipy缺少ndimage

33 投票
4 回答
41319 浏览
提问于 2025-04-17 06:41

我正在尝试使用scipy中的ndimage库,但它似乎缺失了。我已经运行了numpy和scipy的测试,结果都没问题。我使用的是从sourceforge官方包安装的numpy 1.6.1和scipy 0.10.0。

运行

import numpy
import scipy
import pprint

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

img = scipy.ndimage.imread("")

得到的结果是

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'

4 个回答

1

imread这个功能已经不再推荐使用了!在SciPy 1.0.0版本中,imread就被标记为不推荐使用,并且在1.2.0版本中会被彻底移除。建议你使用 imageio.imread 这个功能来代替。

18

模块应该这样导入:

from  scipy import ndimage
65

你需要导入这个模块:

import scipy.ndimage

撰写回答