2

我得到的错误如下:

$ python -c 'from sklearn import preprocessing'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/scikit_learn-0.10-py2.6-linux-x86_64.egg/sklearn/preprocessing/__init__.py", line 17, in <module>
  from ..utils.sparsefuncs import inplace_csr_row_normalize_l1
  File "numpy.pxd", line 174, in init sklearn.utils.sparsefuncs (sklearn/utils/sparsefuncs.c:4605)
ValueError: numpy.ndarray has the wrong size, try recompiling

我认为这是一个错误numpy而不是scikitlearn(见这里

我正在使用 git clone 的开发版本scipynumpy安装(它工作正常)。但是我需要“降级”到稳定版本才能发布。所以我删除了 git 文件夹,并从/usr/local/lib/python-2.6/. (为了安全起见)然后我做了:

$ sudo apt-get install libblas-dev liblapack-dev
$ sudo apt-get install python-dev python-numpy python-scipy
$ sudo easy_install -U distribute
$ sudo easy_install -U numpy
$ sudo easy_install -U scipy

最后两个都给了我警告...

RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import

...我不确定这是否是这里出了问题?

$ python -c 'import numpy; print numpy.__version__'
1.6.2

$ python -c 'import scipy; print scipy.__version__'
0.10.1

我试过删除 apt 安装的版本,但这似乎没有帮助。2.6.32-21-server这是带有内核的 Ubuntu 10.04 (lucid)

4

1 回答 1

0

我建议安装 Enthought Python Distribution。它是免费的,安装在 Ubuntu 10.04 上,并附带 Numpy、Scipy、matplotlib 等。

http://www.enthought.com/products/epd_free.php

于 2012-08-08T17:48:58.497 回答