Python 3.4和2.7:无法为python 3.4安装numpy软件包 [英] Python 3.4 and 2.7: Cannot install numpy package for python 3.4

查看:262
本文介绍了Python 3.4和2.7:无法为python 3.4安装numpy软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 12.04,并且希望将python 3.4与python 2.7并列使用.

I am using Ubuntu 12.04 and want to use python 3.4 side by side with python 2.7.

python 3.4的安装正常工作.但是,我无法为python 3安装numpy软件包(因此,我无法安装scipy,pandas等).

The installation of python 3.4 worked properly. However, I cannot install the numpy package for python 3 (and as a consequence I can't install scipy, pandas etc.).

使用

 sudo pip3 install numpy

吐出以下错误:

File "numpy/core/setup.py", line 289, in check_types

"Cannot compile 'Python.h'. Perhaps you need to "\

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

顺便说一句,我已经安装了python-dev.

Btw, I already have python-dev installed.

此外,通过

 sudo apt-get install python-numpy

也不起作用,因为我已经为python 2.7安装了numpy,并且安装程序响应numpy已经是最新的.

does not work either since I already installed numpy for python 2.7 and the installer responds that numpy is already up to date.

我该怎么办?谢谢!

推荐答案

您尚未安装Python 3 开发包.安装python3.4-dev:

You have not installed the Python 3 development package. Install python3.4-dev:

apt-get install python3.4-dev

主软件包从不包含开发头文件; Debian(以及扩展名为Ubuntu)的软件包政策是将它们放入单独的-dev软件包中.但是,要安装numpy,您需要这些文件才能编译扩展名.

The main package never includes the development headers; Debian (and by extension Ubuntu) package policy is to put those into a separate -dev package. To install numpy however, you need these files to be able to compile the extension.

这篇关于Python 3.4和2.7:无法为python 3.4安装numpy软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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