簡體   English   中英

錯誤:安裝 eventlet 時命令“gcc”失敗,退出狀態為 1

[英]error: command 'gcc' failed with exit status 1 while installing eventlet

我想在我的系統上安裝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

您的安裝失敗,因為您沒有安裝 python 開發頭文件。 您可以通過 apt 在 ubuntu/debian 上執行此操作:

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

最后:

sudo easy_install gevent

CentOS上對我有用的是:

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

對於Redhat 版本(Centos 7)使用以下命令安裝 Python 開發包

蟒蛇 2.7

須藤 yum 安裝 python-dev

蟒蛇 3.4

須藤 yum 安裝 python34-devel

蟒蛇 3.6

須藤 yum 安裝 python36-devel

如果問題仍未解決,請嘗試安裝以下軟件包 -

須藤 yum 安裝 python-devel

須藤 yum 安裝 openssl-devel

須藤 yum 安裝 libffi-devel

MacOS上我遇到了麻煩,安裝fbprophet需要pystan需要gcc來編譯。 我會一直得到同樣的錯誤:命令 'gcc' failed with exit status 1

我想我為自己解決了這個問題:

我使用brew install gcc來安裝最新版本,最終是gcc-8

然后我確保當gcc運行時它會使用gcc-8代替。

它要么有效,因為我在我的.zshrc添加了alias gcc='gcc-8 (與.bashrc相同,但用於zsh ),或者因為我運行了export PATH=/usr/local/bin:$PATH (見評論

另外:我所有的嘗試都是在虛擬環境中進行的,我只是通過全局安裝fbprophet (使用pip )而成功,但在venv 中仍然沒有成功

這是一篇舊帖子,但我在安裝正則表達式的 AWS EC2 上遇到了同樣的問題。 這對我來說完美無缺

sudo yum -y install gcc

接下來

sudo yum -y install gcc-c++

試試這個 :

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

我在 Ubuntu 14.04 上遇到了類似的問題。 對我來說以下 Ubuntu 軟件包

MacOS 上,我在嘗試安裝fbprophet也遇到了問題,該fbprophetgcc作為其依賴項之一。

在嘗試了@ Boris推薦的幾個步驟之后,來自Facebook Prophet 項目頁面的以下命令最終對我有用。

conda install -c conda-forge fbprophet

它為fbprophet安裝了所有需要的依賴fbprophet 確保您已安裝 anaconda。

對於 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

對於 openSUSE 42.1 Leap Linux 使用這個

sudo zypper install python3-devel

如果還是不行,你可以試試這個

sudo apt-get install build-essential

就我而言,它解決了問題。

對於即將出現的所有進一步的 lib 問題,此頁面將挽救您的生命,

對於高山(>=3.6),

使用apk --update --upgrade add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev

我正在使用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

如果你像我一樣使用 Mac,請在終端中嘗試:xcode-select --install

然后接受安裝請求,然后它就可以工作了https://github.com/python-pillow/Pillow/issues/3438

從源代碼構建並安裝,這在最新版本 (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

同樣,我像這樣修復它(注意python34 ):

sudo yum install python34-devel

sudo apt install gcc

它適用於 Ubuntu 20.10 上的 PyCharm。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM