我試圖在我的Linux Mint 12上安裝scikit-learn,但失敗了。我從http://pypi.python.org/pypi/scikit-learn/下載的軟件包,並安裝了無法導入Scikit-Learn
sudo python2.7 setup.py install
然後我改變了目錄,對家庭,開始python2.7外殼。在進口sklearn我得到:
>>> import sklearn
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning:
numpy.dtype size changed, may indicate binary incompatibility
from ckdtree import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning:
numpy.ndarray size changed, may indicate binary incompatibility
from ckdtree import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning:
numpy.ufunc size changed, may indicate binary incompatibility
from ckdtree import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:8: RuntimeWarning:
numpy.dtype size changed, may indicate binary incompatibility
from qhull import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:8: RuntimeWarning:
numpy.ndarray size changed, may indicate binary incompatibility
from qhull import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:8: RuntimeWarning:
numpy.ufunc size changed, may indicate binary incompatibility
from qhull import *
我認爲問題是與scipy的空間。這是因爲當我做
>>> from scipy import spatial
我得到同樣的錯誤,我得到的Scikit學習。
請幫忙。 謝謝。
編輯:新錯誤。
>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.12_git-py2.7-linux-
x86_64.egg/sklearn/__init__.py", line 17, in <module>
from .base import clone
File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.12_git-py2.7-linux-
x86_64.egg/sklearn/base.py", line 11, in <module>
from .metrics import r2_score
File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.12_git-py2.7-linux-
x86_64.egg/sklearn/metrics/__init__.py", line 6, in <module>
from .metrics import confusion_matrix, roc_curve, auc, precision_score, \
File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.12_git-py2.7-linux-
x86_64.egg/sklearn/metrics/metrics.py", line 17, in <module>
from ..utils import check_arrays
File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.12_git-py2.7-linux-
x86_64.egg/sklearn/utils/__init__.py", line 9, in <module>
from .murmurhash import murmurhash3_32
File "numpy.pxd", line 174, in init sklearn.utils.murmurhash (sklearn/utils
/murmurhash.c:4776)
ValueError: numpy.ndarray has the wrong size, try recompiling
謝謝mgibsonbr。我從源代碼重新安裝了scipy和numpy。之後'從scipy導入空間'沒有給出任何錯誤。但是,在導入sklearn時,我得到了一個不同的錯誤。我正在寫上面的錯誤。 – Rishi 2012-07-13 06:21:56
我用'pip install -U scikit-learn'再次安裝了scikit-learn,之後導入工作。謝謝。 :) – Rishi 2012-07-13 06:42:27
@Rishi那不適合我。我仍然得到'/usr/local/lib/python2.7/dist-packages/scipy/spatial/__init__.py:91:RuntimeWarning:numpy.ufunc的大小改變,可能表明.qhull導入的二進制不兼容*' – 2014-08-25 13:31:07