Trouble importing filters using skimage

假如想象 提交于 2019-12-10 10:56:32

问题


I have been using the Skimage package for quite a while in Python 2.7.

Recently I upgrade my Ubuntu to 14.10 And now I can not import filters (used to be filter) from the Skimage package.

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
>>> 

回答1:


Try

from skimage import filter

instead of

from skimage import filters

I was getting the same error and it was solved




回答2:


Try

pip install -U scikit-image




回答3:


The problem is with the version of scikit-image. In skimage '0.10.1' there is no module named 'filters' as it has 'filter'. So upgrade it using the command 'sudo pip install --upgrade scikit-image' and it will be upgraded to version '0.13.1' which contains module 'filters' and not 'filter'.



来源:https://stackoverflow.com/questions/33686005/trouble-importing-filters-using-skimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!