Python3.4和2.7:无法为Python3.4安装numpy包

2024-04-27 11:08:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用Ubuntu12.04,希望与Python2.7一起使用Python3.4。

python 3.4的安装工作正常。但是,我不能为python 3安装numpy包(因此我不能安装scipy、pandas等)。

使用

 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。

此外,通过

 sudo apt-get install python-numpy

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

我能做什么?谢谢!


Tags: installtodevnumpyyoupandas错误pip3
1条回答
网友
1楼 · 发布于 2024-04-27 11:08:10

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

apt-get install python3.4-dev

主包从不包含开发头;Debian(扩展名为Ubuntu)包策略是将这些头放在单独的-dev包中。但是,要安装numpy,您需要这些文件才能编译扩展名。

相关问题 更多 >