导入sklearn时出错

时间:2016-11-26 10:52:43

标签: scikit-learn

我使用sklearn库已经很多天了,但今天我不能导入sklearn。在sicpy库中存在一些我无法找到解决方案的问题。 在我运行apt-get update

之后,这个问题就开始了

这是我得到的错误。

   Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/usr/local/lib/python2.7/dist-packages/sklearn/base.py", line 12, in <module>
    from .utils.fixes import signature
  File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/__init__.py", line 11, in <module>
    from .validation import (as_float_array,
  File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 18, in <module>
    from ..utils.fixes import signature
  File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/fixes.py", line 45, in <module>
    from scipy.special import expit     # SciPy >= 0.10
  File "/usr/lib/python2.7/dist-packages/scipy/special/__init__.py", line 643, in <module>
    from ._ellip_harm import ellip_harm, ellip_harm_2, ellip_normal
  File "/usr/lib/python2.7/dist-packages/scipy/special/_ellip_harm.py", line 7, in <module>
    from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm
  File "scipy/special/_ellip_harm_2.pyx", line 5, in init scipy.special._ellip_harm_2 (scipy/special/_ellip_harm_2.c:7330)
  File "/usr/lib/python2.7/dist-packages/scipy/integrate/__init__.py", line 59, in <module>
    from ._bvp import solve_bvp
  File "/usr/lib/python2.7/dist-packages/scipy/integrate/_bvp.py", line 10, in <module>
    from scipy.sparse.linalg import splu
  File "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/__init__.py", line 112, 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 84, in <module>
    def bicg(A, b, x0=None, tol=1e-5, maxiter=None, xtype=None, M=None, callback=None):
  File "/usr/lib/python2.7/dist-packages/scipy/_lib/_threadsafety.py", line 59, in decorator
    return lock.decorate(func)
  File "/usr/lib/python2.7/dist-packages/scipy/_lib/_threadsafety.py", line 47, in decorate
    return scipy._lib.decorator.decorate(func, caller)
AttributeError: 'module' object has no attribute 'decorate'
>>> 

我试过的解决方案:

  • 重新启动电脑
  • 重新安装sklearn
  • 重新安装sicpy
  • 把我的头撞到电脑上

请尽快帮忙,因为我需要它来完成我的学期项目。

1 个答案:

答案 0 :(得分:1)

更新python-decorator。 看起来像依赖bug。