【问题标题】:'gcc' failed with exit status 1 while trying to install gevent-websocket'gcc' 在尝试安装 gevent-websocket 时失败,退出状态为 1
【发布时间】:2012-04-02 23:22:46
【问题描述】:

我正在尝试为 Python (http://www.gelens.org/code/gevent-websocket/) 安装 gevent-websocket,但是当我运行 easy_install gevent-websocket 时,我得到“命令 'gcc' failed with退出状态 1"。

以下是终端的完整输出。

tgarv@tommy-Studio-1537:~/Desktop/Code$ sudo easy_install gevent-websocket
install_dir /usr/local/lib/python2.6/dist-packages/
Searching for gevent-websocket
Best match: gevent-websocket 0.3.4
Processing gevent_websocket-0.3.4-py2.6.egg
gevent-websocket 0.3.4 is already the active version in easy-install.pth

Using /usr/local/lib/python2.6/dist-packages/gevent_websocket-0.3.4-py2.6.egg
Processing dependencies for gevent-websocket
Searching for gevent
Reading http://pypi.python.org/simple/gevent/
Reading http://www.gevent.org/
Reading http://gevent.org/
Best match: gevent 0.13.6
Downloading http://pypi.python.org/packages/source/g/gevent/gevent-0.13.6.tar.gz#md5=7c836ce2315d44ba0af6134efbcd38c9
Processing gevent-0.13.6.tar.gz
Running gevent-0.13.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-zChaNp/gevent-0.13.6/egg-dist-tmp-cPxcYh
In file included from gevent/core.c:225:
gevent/libevent.h:9: fatal error: event.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
tgarv@tommy-Studio-1537:~/Desktop/Code$ 

我在尝试 pip install 时也遇到了同样的错误,所以我对下一步该做什么有点茫然。输出显示“gevent-websocket 0.3.4 已经是 easy-install.pth 中的活动版本”,我不确定这意味着什么,但我知道如果我尝试导入 gevent 或 geventwebsocket,它会显示模块不存在。

【问题讨论】:

    标签: python websocket gevent


    【解决方案1】:
    gevent/libevent.h:9: fatal error: event.h: No such file or directory
    

    为您的发行版安装 libevent 开发包。

    在 Ubuntu 下是libevent-dev

    【讨论】:

      【解决方案2】:

      如果您使用的是 Ubuntu,请键入以下内容:

       sudo apt-get install libevent-dev
       pip install gevent
      

      【讨论】:

        【解决方案3】:

        https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

        步骤 - 1 转到此网站页面并根据您的 python 版本查找 gevent.whl 文件 并下载它。

        步骤 - 2 在命令提示符下, 将目录更改为下载的gevent.whl文件,并在格式下复制.. C:\Users\ACER\Download>pip install .\gevent.whl

        步骤 - 3 在 python 外壳中, 像“import gevent”一样尝试一下。 我认为它会起作用的!成功...

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2015-01-26
          • 1970-01-01
          • 1970-01-01
          • 2023-03-08
          • 1970-01-01
          • 1970-01-01
          • 2012-06-21
          • 2019-12-01
          相关资源
          最近更新 更多