由于numpy错误,Sklearn将无法运行/编译

时间:2016-05-14 15:00:10

标签: numpy flask scikit-learn

如果我没有彻底研究过这个问题,我不会发布这个问题。我运行python server.py(它使用sklearn)。哪个给了我

Traceback (most recent call last):
  File "server.py", line 34, in <module>
    from lotusApp.lotus import lotus
  File "/Users/natumyers/Desktop/.dev/qq/lotusApp/lotus.py", line 2, in <module>
    from sklearn import datasets
  File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>
    from .utils.fixes import signature
  File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>
    from .murmurhash import murmurhash3_32
  File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling

接下来我会尽我所能,没有任何帮助。

我跑了:

sudo -H pip uninstall numpy
sudo -H pip uninstall pandas

sudo -H pip install numpy
sudo -H pip install pandas

所有这些都会给我带来OSError: [Errno 1] Operation not permitted:

等错误

我尝试sudo -H easy_install --upgrade numpy

我得到了一个错误列表,如

_configtest.c:13:5: note: 'ctanl' is a builtin with type '_Complex long double (_Complex long double)'
_configtest.c:14:5: warning: incompatible redeclaration of library function 'cpowl' [-Wincompatible-library-redeclaration]
int cpowl (void);
    ^

编辑:问题的一部分可能是我没有运行虚拟环境。所以我明白了,当我输入python server.py时,我收到错误:

from sklearn import datasets
ImportError: No module named sklearn

sudo -H pip install -U scikit-learn由于其他错误而无法安装....

1 个答案:

答案 0 :(得分:1)

我使用的是折旧的python。我将所有内容更新为python 3,并使用了pip3