0
我在sklearn庫中使用了很多天,但今天突然發現我不能導入sklearn。在我無法找到解決方案的sicpy庫中存在一些問題。 而我跑過後,這個問題開始得很好apt-get update
導入sklearn時出錯
這是我收到的錯誤。
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'
>>>
解決方案我想:
- 重新啓動PC
- 重新安裝sklearn
- 重新安裝sicpy
- 敲我的頭,PC
請儘快幫忙,因爲我需要它完成我的學期項目。
我建議先安裝Anaconda,然後嘗試通過它安裝所有必需的軟件包。 – Nain
好吧,讓我試試。 – 2016-11-26 10:59:00
你有沒有跑過'升級'的機會?任何方式,一般來說,我會避免使用系統的Python進行任何工作。幫你一個忙,創建一個虛擬環境(virtualenv)。正是你剛剛描述的原因:)。蟒蛇也很好。 –