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.