2012-06-19 68 views
148

我想,纔能有「追風」的軟件部署我的系統上安裝eventlet ..但終端則呈現出GCC錯誤:錯誤:命令「GCC」,退出狀態1失敗而安裝eventlet

[email protected]:~# 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` 

爲什麼找不到Python.h

回答

310

您的安裝失敗,因爲您沒有安裝python開發頭文件。您可以通過易上這樣做的Ubuntu/Debian中:

sudo apt-get install python-dev 

爲python3使用:

sudo apt-get install python3-dev 

對於eventlet,你可能還需要安裝了libevent庫,因此,如果你得到一個錯誤談論你可以安裝使用的libevent:

sudo apt-get install libevent-dev 
+1

FWIW,你肯定需要雙方的python-dev的和的libevent-dev的。謝謝! –

+34

對於fedora,你可以使用:'sudo yum install python-devel' –

+6

我建議在運行這兩個命令之前運行'sudo apt-get update'。我遇到'sudo apt-get install python-dev'錯誤。 – AliBZ

22

爲Fedora:

sudo yum install python-devel 

sudo yum install libevent-devel 

最後:

easy_install gevent 
+0

它會實際上是'sudo easy_install gevent' ... – NerdOfCode

0

從源代碼編譯和安裝,這將固定在最新版本(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 
2

爲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 

終端信息:

[[email protected] ~]# 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 
+0

當我運行時,它給了我錯誤 「無法執行'gcc':沒有這樣的文件或目錄」 – Sarang

+2

@Sarang,這意味着你還沒有安裝gcc,執行:「yum -y install gcc」 –

2

openSUSE的42.1飛躍的Linux使用此

sudo zypper install python3-devel 
+0

歡迎來到Stack Overflow。請注意,這與答案一樣多。在主要答案下有許多評論,它們描述了不同Linux發行版的替代方案。我意識到你還不能發表評論。對那些確實是「評論」的已確定問題添加「答案」時要小心謹慎。 –

6

紅帽版本(Centos的7)請使用以下命令來安裝Python開發包

Python 2.7版

sudo yum install python-dev

的Python 3.4

sudo yum install python34-devel

不過,如果你的問題沒有解決,然後嘗試安裝下面的包 -

sudo yum install libffi-devel

sudo yum install openssl-devel

sudo yum install python-devel

+0

'沒有可用的軟件包python-dev。'我正在接受這個。 –

+1

嗨@NishantKumar確保你正在使用centos併爲python2.x安裝它。你也可以嘗試「sudo yum install python-devel」 –

1

試試這個:

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

我在Ubuntu 14.04上有類似的問題。對於我下面的Ubuntu軟件包

0

我嘗試了所有上述的答案。但是,什麼工作對我來說是爲CentOS的

sudo yum -y install gcc 
sudo yum install python-devel 
相關問題