小编典典

Ubuntu 12.04中缺少Python.h

python

我使用以下命令在Ubuntu 12.04上安装了一个名为RYU的openflow控制器:

 sudo  pip install ryu

我试图使用ryu-manager运行python文件,如下所示。

sudo ryu-manager simple_switch.py 
Traceback (most recent call last):
  File "/usr/local/bin/ryu-manager", line 19, in <module>
    import gevent
ImportError: No module named gevent

然后我尝试使用以下方法安装gevent:

sudo pip install gevent
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-x86_64-2.7/gevent/core.o
gevent/core.c:4:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

此错误的原因是什么?我试图找到Python.h使用sudo locate Python.h,但没有成功。python -V但是的输出是

Python 2.7.3

Python.h系统上应该有吗?如果是这样,我应该安装什么来获得它?


阅读 155

收藏
2020-12-20

共1个答案

小编典典

应该这样做:

sudo apt-get update; sudo apt-get install python-dev -y

它将安装所有缺少的标题。这对我帮助很大。

2020-12-20