我在Python 2.7中使用了Skimage软件包已有一段时间了。
最近我将我的Ubuntu升级到14.10现在我无法从Skimage包中导入过滤器(以前是过滤器)。
Python 2.7.9 (default, Apr 2 2015, 15:33:21)
[GCC 4.9.2] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> from skimage import filters
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from skimage import filters
File "/usr/local/lib/python2.7/dist-packages/skimage/filters/__init__.py", line 17, in <module>
from .. import restoration
File "/usr/local/lib/python2.7/dist-packages/skimage/restoration/__init__.py", line 21, in <module>
from .deconvolution import wiener, unsupervised_wiener, richardson_lucy
File "/usr/local/lib/python2.7/dist-packages/skimage/restoration/deconvolution.py", line 10, in <module>
from scipy.signal import convolve2d
File "/usr/lib/python2.7/dist-packages/scipy/signal/__init__.py", line 240, in <module>
from .cont2discrete import *
File "/usr/lib/python2.7/dist-packages/scipy/signal/cont2discrete.py", line 12, in <module>
from .ltisys import tf2ss, ss2tf, zpk2ss, ss2zpk
File "/usr/lib/python2.7/dist-packages/scipy/signal/ltisys.py", line 16, in <module>
from .filter_design import tf2zpk, zpk2tf, normalize, freqs
File "/usr/lib/python2.7/dist-packages/scipy/signal/filter_design.py", line 13, in <module>
from scipy import special, optimize
File "/usr/lib/python2.7/dist-packages/scipy/optimize/__init__.py", line 165, in <module>
from ._root import *
File "/usr/lib/python2.7/dist-packages/scipy/optimize/_root.py", line 20, in <module>
from . import nonlin
File "/usr/lib/python2.7/dist-packages/scipy/optimize/nonlin.py", line 122, in <module>
import scipy.sparse.linalg
File "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/__init__.py", line 109, in <module>
from .isolve import *
File "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/isolve/__init__.py", line 6, in <module>
from .iterative import *
File "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/isolve/iterative.py", line 11, in <module>
from scipy.lib.decorator import decorator
ImportError: No module named decorator
>>> import skimage
>>> from skimage import filters
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from skimage import filters
File "/usr/local/lib/python2.7/dist-packages/skimage/filters/__init__.py", line 13, in <module>
from . import rank
ImportError: cannot import name rank
>>> import rank
>>>
答案 0 :(得分:8)
尝试
pip install -U scikit-image
答案 1 :(得分:2)
尝试
from skimage import filter
而不是
from skimage import filters
我遇到了同样的错误并且已经解决了
答案 2 :(得分:-1)
问题在于scikit-image的版本。 在skimage'0.10.1'中没有名为'filters'的模块,因为它有'过滤器'。 因此,使用命令'sudo pip install --upgrade scikit-image'升级它,它将升级到版本'0.13.1',其中包含模块'filters'而不是'filter'。