我正在使用Ubuntu 12.04,想要将Python 3.4与Python 2.7并行使用。
安装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。
此外,通过以下方式安装numpy
sudo apt-get install python-numpy
由于我已经为Python 2.7安装了numpy,而安装程序回复numpy已经是最新版本,所以这也行不通。
我该怎么办?谢谢!
apt-get install python3-dev
命令,Ubuntu会自动识别你的版本并安装正确的点发行版。 - Dave LeBlancSystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel
- Alex Eastmanmingw-w64-x86_64-python3
是一个软件包,请查找一个-devel
或-dev
软件包来安装Python头文件,我猜是这样。 - Martijn Pieters