我正在尝试为Python安装gevent-websocket(http://www.gelens.org/code/gevent-websocket/),但当我运行easy_install gevent-websocket时,我得到"命令'gcc'失败,退出状态为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安装时也会遇到同样的错误,所以我对下一步该怎么办有点不知道。输出显示"gevent-websocket 0.3.4已经是easy-install.pth中的活动版本",我不确定这意味着什么,但我知道如果我尝试导入gevent或gevent-wwebsocket,它会显示模块不存在。
gevent/libevent.h:9: fatal error: event.h: No such file or directory
为您的发行版安装libevent开发包。
在Ubuntu下,它是libevent-dev
。
如果你在Ubuntu上,请键入以下内容:
sudo apt-get install libevent-dev
pip install gevent
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
步骤-1转到此网站页面,根据您的python版本查找gevent.whl文件并下载。
步骤-2在命令提示符下,将目录更改为下载的gevent.whl文件,并以..格式复制。。C: \Users\ACER\下载>pip安装。\gevent.whl
步骤-3在python shell中,像";导入gevent";。。我认为它会起作用的!成功。。。