问题:错误:安装eventlet时命令’gcc’失败,退出状态为1

我想eventlet在我的系统上安装,以使“ Herd”用于软件部署。.但是终端显示了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`

为什么Python.h找不到?

I wanted to install eventlet on my system in order to have “Herd” for software deployment.. but the terminal is showing a gcc error:

  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`

Why can’t Python.h be found?


回答 0

您的安装失败,因为您没有安装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

Your install is failing because you don’t have the python development headers installed. You can do this through apt on ubuntu/debian with:

sudo apt-get install python-dev 

for python3 use:

sudo apt-get install python3-dev

For eventlet you might also need the libevent libraries installed so if you get an error talking about that you can install libevent with:

sudo apt-get install libevent-dev

回答 1

对于Fedora:

sudo yum install python-devel

sudo yum install libevent-devel

最后:

sudo easy_install gevent

For Fedora:

sudo yum install python-devel

sudo yum install libevent-devel

and finally:

sudo easy_install gevent

回答 2

CentOS上对我有用的是:

sudo yum -y install gcc
sudo yum install python-devel

What worked for me on CentOS was:

sudo yum -y install gcc
sudo yum install python-devel

回答 3

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

Python 2.7

须藤百胜安装python-dev

Python 3.4

须藤百胜安装python34-devel

如果您的问题仍未解决,请尝试安装以下软件包-

须藤百胜安装python-devel

须藤yum install openssl-devel

sudo yum安装libffi-devel

For Redhat Versions(Centos 7) Use the below command to install Python Development Package

Python 2.7

sudo yum install python-dev

Python 3.4

sudo yum install python34-devel

If the issue is still not resolved then try installing the below packages –

sudo yum install python-devel

sudo yum install openssl-devel

sudo yum install libffi-devel


回答 4

MacOS的我遇到了麻烦,安装fbprophet要求pystan,需要gcc进行编译。我将始终收到相同的错误:命令“ gcc”失败,退出状态为1

我想我自己解决了这个问题:

brew install gcc以前安装的是最新版本,gcc-8

然后,我确保在gcc运行时将使用它gcc-8

它要么工作,因为我说alias gcc='gcc-8在我的.zshrc(相同.bashrczsh的),或者是因为我跑export PATH=/usr/local/bin:$PATH(见注释

另外:我所有的尝试都在虚拟环境中进行,并且仅通过fbprophet全局安装(使用pip)成功完成,但在venv内部仍未成功

On MacOS I had trouble installing fbprophet which requires pystan which requires gcc to compile. I would consistently get the same error: command ‘gcc’ failed with exit status 1

I think I fixed the problem for myself thus:

I used brew install gcc to install the newest version, which ended up being gcc-8

Then I made sure that when gcc ran it would use gcc-8 instead.

It either worked because I added alias gcc='gcc-8 in my .zshrc (same as .bashrc but for zsh), or because I ran export PATH=/usr/local/bin:$PATH (see comment)

Also: all my attempts were inside a virtual environment and I only succeeded by installing fbprophet globally (with pip), but still no success inside a venv


回答 5

试试这个 :

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

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

try this :

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

I had a similar issue on Ubuntu 14.04. For me the following Ubuntu packages


回答 6

对于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

安装事件:

sudo yum install python-devel
sudo easy_install -ZU eventlet

码头信息:

[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

For 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

Install eventlet:

sudo yum install python-devel
sudo easy_install -ZU eventlet

Terminal info:

[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

回答 7

对于openSUSE 42.1 Leap Linux,使用此命令

sudo zypper install python3-devel

For openSUSE 42.1 Leap Linux use this

sudo zypper install python3-devel

回答 8

这是一篇旧文章,但我在安装regex的AWS EC2上遇到了同样的问题。这完全适合我

sudo yum -y install gcc

接下来

sudo yum -y install gcc-c++

This is an old post but I just run to the same problem on AWS EC2 installing regex. This working perfectly for me

sudo yum -y install gcc

and next

sudo yum -y install gcc-c++

回答 9

MacOS上,我也有尝试安装的问题fbprophetgcc作为它的一个依赖。

在尝试了@ Boris建议的几个步骤之后,Facebook Prophet项目页面上的以下命令最终为我工作了。

conda install -c conda-forge fbprophet

它安装了所需的所有依赖项fbprophet。确保已安装anaconda。

On MacOS I also had problems trying to install fbprophet which had gcc as one of its dependencies.

After trying several steps as recommended by @Boris the command below from the Facebook Prophet project page worked for me in the end.

conda install -c conda-forge fbprophet

It installed all the needed dependencies for fbprophet. Make sure you have anaconda installed.


回答 10

从源代码构建并安装,在最新版本(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

Build from source and install, this is fixed in the latest release (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

回答 11

如果仍然无法使用,可以尝试一下

sudo apt-get install build-essential

就我而言,它解决了问题。

If it is still not working, you can try this

sudo apt-get install build-essential

in my case, it solved the problem.


回答 12

同样,我将其固定为:(请注意python34):

sudo yum install python34-devel

Similarly I fixed it like this (notice python34):

sudo yum install python34-devel

回答 13

我正在使用MacOS catalina 10.15.4。没有发布的解决方案对我有用。对我有用的是:

 >> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

>> env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2==2.8.4
Collecting psycopg2==2.8.4
  Using cached psycopg2-2.8.4.tar.gz (377 kB)
Installing collected packages: psycopg2
  Attempting uninstall: psycopg2
    Found existing installation: psycopg2 2.7.7
    Uninstalling psycopg2-2.7.7:
      Successfully uninstalled psycopg2-2.7.7
    Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.4

pip3用于python3

I am using MacOS catalina 10.15.4. None of the posted solutions worked for me. What worked for me is:

 >> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

>> env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2==2.8.4
Collecting psycopg2==2.8.4
  Using cached psycopg2-2.8.4.tar.gz (377 kB)
Installing collected packages: psycopg2
  Attempting uninstall: psycopg2
    Found existing installation: psycopg2 2.7.7
    Uninstalling psycopg2-2.7.7:
      Successfully uninstalled psycopg2-2.7.7
    Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.4

use pip3 for python3


回答 14

如果您是Mac用户,请在终端上尝试:xcode-select –install

然后接受安装请求,然后再运行 https://github.com/python-pillow/Pillow/issues/3438

if you are on Mac as myself, try in terminal: xcode-select –install

Then accept the installation request, then it works afterward https://github.com/python-pillow/Pillow/issues/3438


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。