当前位置: 主页 > 日志 > Python >

gevent的安装

Windows:

建议安装二进制版本,先装greenlet,再装gevent:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#greenlet

http://www.lfd.uci.edu/~gohlke/pythonlibs/#gevent

 

Ubuntu:

先编译安装libevent:

http://libevent.org/ e.g. https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz

再安装greenlet:

可以用sudo easy_install greelet

最后编译安装gevent(或用sudo easy_install gevent),http://pypi.python.org/packages/source/g/gevent/gevent-0.13.6.tar.gz#md5=7c836ce2315d44ba0af6134efbcd38c9

如果遇到引入gevent模块时出现找不到libevent-2.0.so的错误,如下:

 

Python 2.7 (r27:82500, Jan  5 2012, 23:44:19) 

[GCC 4.4.3] on linux3

Type "help", "copyright", "credits" or "license" for more information.

>>> import gevent

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "build/bdist.linux-i686/egg/gevent/__init__.py", line 41, in <module>

  File "build/bdist.linux-i686/egg/gevent/core.py", line 7, in <module>

  File "build/bdist.linux-i686/egg/gevent/core.py", line 6, in __bootstrap__

ImportError: libevent-2.0.so.5: cannot open shared object file: No such file or directory

添加/usr/local/lib到LD_LIBRARY_PATH即可:

编辑~/.bashrc,在末尾加入:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

保存,重新载入:source  ~/.bashrc

该问题的详细说明见这里:http://stackoverflow.com/questions/1099981/why-cant-python-find-shared-objects-that-are-in-directories-in-sys-path

 

[日志信息]

该日志于 2012-03-07 20:47 由 redice 发表在 redice's Blog ,你除了可以发表评论外,还可以转载 “gevent的安装” 日志到你的网站或博客,但是请保留源地址及作者信息,谢谢!!    (尊重他人劳动,你我共同努力)
   
验证(必填):   点击我更换验证码

redice's Blog  is powered by DedeCms |  Theme by Monkeii.Lee |  网站地图 |  本服务器由西安鲲之鹏网络信息技术有限公司友情提供

返回顶部