program story

Ubuntu 12.04에서 Python.h 누락

inputbox 2020. 11. 6. 08:13
반응형

Ubuntu 12.04에서 Python.h 누락


저는 파이썬을 처음 접했습니다. 다음을 사용하여 RYU라는 Linux PC (Ubunutu 12.04)에 openflow 컨트롤러를 설치했습니다.

 sudo  pip install ryu

아래와 같이 ryu-manager를 사용하여 파이썬 파일을 실행하려고했습니다.

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가 시스템에 있어야합니까? 그렇다면 무엇을 설치해야합니까?


이렇게해야합니다.

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

누락 된 헤더를 설치합니다. 많은 도움이되었습니다.


Python이 설치되어 있어도 헤더 파일과 라이브러리는 일반적으로 기본적으로 설치되지 않습니다. Ubuntu에서는 python-dev.


gevent직접 설치 - sudo apt-get install python-gevent.

참고 URL : https://stackoverflow.com/questions/15631135/python-h-missing-from-ubuntu-12-04

반응형