scikit-learn安装失败/找不到numpy/缺少numpy标头 [英] scikit-learn install failure / numpy not found / missing numpy headers

查看:206
本文介绍了scikit-learn安装失败/找不到numpy/缺少numpy标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过以下方式在Suse(openSuse 12.2 x86_64)服务器上安装scikit-learn时:

When i try to install scikit-learn on a Suse (openSuse 12.2 x86_64) server via:

pip install -U scikit-learn

我收到以下错误:

(....)

compile options: '-I/usr/lib64/python2.7/site-packages/numpy/core/include -Isklearn/svm/src/libsvm -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'

gcc: sklearn/svm/libsvm.c

sklearn/svm/libsvm.c:303:31: fatal error: numpy/arrayobject.h: No such file or directory

compilation terminated.

sklearn/svm/libsvm.c:303:31: fatal error: numpy/arrayobject.h: No such file or directory

compilation terminated.

我已经尝试过:

-将gcc安装到最新版本
通过easy_install从下载的zip安装scikit(以避免旧的回购协议) -卸载并重新安装numpy(通过pip)

-installing gcc to the latest version
-installing scikit from a downloaded zip, over easy_install (to avoid old repos) -uninstalling and reinstalling numpy (over pip)

当我尝试安装scipy时(这是numpy的要求),我得到了类似的错误:

When i try to install scipy (which is a requirement of numpy) i get a similar Error:

adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.

adding 'build/src.linux-x86_64-2.7' to include_dirs.

error: file '/usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.c' does not exist

显然,"site-packages/numpy/core/include"中的所有numpy标头都丢失了.我已经用pip重新安装了numpy,没有任何问题,但是标题仍然丢失.

Apparently all the numpy headers in "site-packages/numpy/core/include" are missing. I already reinstalled numpy with pip without any Problems but the headers are still missing.

推荐答案

好,当我使用pip安装numpy或通常缺少所有包含标头时.

Ok when i installed numpy with pip or normally all the include header were missing.

要解决此问题,我安装了包含标头的软件包"python-numpy-devel" (带有zypper,愚蠢的suse软件包名称...).

To fix this i installed the package "python-numpy-devel" (with zypper, stupid suse package names...) which contains the headers.

之后,标题就在那里,其余的都起作用了.

After that the headers are there and the rest works.

这篇关于scikit-learn安装失败/找不到numpy/缺少numpy标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆