错误:安装eventlet时,命令“gcc”失败,退出状态为1

我想在我的系统上安装eventlet ,以便为软件部署“Herd”..但terminal显示gcc错误:

  root@agrover-OptiPlex-780:~# easy_install -U eventlet Searching for eventlet Reading http://pypi.python.org/simple/eventlet/ Reading http://wiki.secondlife.com/wiki/Eventlet Reading http://eventlet.net Best match: eventlet 0.9.16 Processing eventlet-0.9.16-py2.7.egg eventlet 0.9.16 is already the active version in easy-install.pth Using /usr/local/lib/python2.7/dist-packages/eventlet-0.9.16-py2.7.egg Processing dependencies for eventlet Searching for greenlet>=0.3 Reading http://pypi.python.org/simple/greenlet/ Reading https://github.com/python-greenlet/greenlet Reading http://bitbucket.org/ambroff/greenlet Best match: greenlet 0.3.4 Downloading http://pypi.python.org/packages/source/g/greenlet/greenlet- 0.3.4.zip#md5=530a69acebbb0d66eb5abd83523d8272 Processing greenlet-0.3.4.zip Writing /tmp/easy_install-_aeHYm/greenlet-0.3.4/setup.cfg Running greenlet-0.3.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_aeHYm/greenlet-0.3.4/egg-dist-tmp-t9_gbW In file included from greenlet.c:5:0: greenlet.h:8:20: fatal error: Python.h: No such file or directory compilation terminated. error: Setup script exited with error: command 'gcc' failed with exit status 1` 

为什么不能findPython.h

你的安装失败,因为你没有安装Python开发头。 你可以在ubuntu / debian上通过apt来做到这一点:

 sudo apt-get install python-dev 

对于python3使用:

 sudo apt-get install python3-dev 

对于eventlet,你可能还需要安装libevent库,所以如果你有一个错误的话,你可以安装libevent:

 sudo apt-get install libevent-dev 

对于Fedora:

 sudo yum install python-devel sudo yum install libevent-devel 

最后:

 easy_install gevent 

对于Redhat版本(Centos 7)使用以下命令来安装Python开发包

Python 2.7

sudo yum安装python-dev

Python 3.4

sudo yum安装python34-devel

如果你的问题仍然没有解决,然后尝试安装下面的包 –

sudo yum安装libffi-devel

sudo yum安装openssl-devel

对于openSUSE 42.1 Leap Linux使用这个

 sudo zypper install python3-devel 

对于CentOS 7.2:

 LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.2.1511 (Core) Release: 7.2.1511 Codename: Core 

安装eventlet:

 sudo yum install python-devel sudo easy_install -ZU eventlet 

terminal信息:

 [root@localhost ~]# easy_install -ZU eventlet Searching for eventlet Reading http://pypi.python.org/simple/eventlet/ Best match: eventlet 0.19.0 Downloading https://pypi.python.org/packages/5a/e8/ac80f330a80c18113df0f4f872fb741974ad2179f8c2a5e3e45f40214cef/eventlet-0.19.0.tar.gz#md5=fde857181347d5b7b921541367a99204 Processing eventlet-0.19.0.tar.gz Running eventlet-0.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Hh9GQY/eventlet-0.19.0/egg-dist-tmp-rBFoAx Adding eventlet 0.19.0 to easy-install.pth file Installed /usr/lib/python2.6/site-packages/eventlet-0.19.0-py2.6.egg Processing dependencies for eventlet Finished processing dependencies for eventlet 

尝试这个 :

 sudo apt-get install libblas-dev libatlas-base-dev 

我在Ubuntu 14.04上遇到类似的问题。 对我来说,下面的Ubuntu软件包

从源代码安装,并在最新版本(10.3+)中修复:

 mkdir -p /tmp/install/netifaces/ cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz#md5=36da76e2cfadd24cc7510c2c0012eb1e" tar xvzf netifaces-0.10.4.tar.gz cd netifaces-0.10.4 && python setup.py install