为什么pythonnumpy包安装不了,Python 3.4和2.7:无法为python 3.4安装numpy软件包

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

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.).

Using

sudo pip3 install numpy

spits out the following error:

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.

Btw, I already have python-dev installed.

Moreover, installing numpy via

sudo apt-get install python-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.

What can I do? Thanks!

解决方案

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

apt-get install python3.4-dev

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值