(请确保xcode command line tools已经安装)

直接使用 =pip install= 会出现 =event.h= 找不到:

1
2
3
4
5
6
7
clang: warning: argument unused during compilation: '-mno-fused-madd'
In file included from gevent/core.c:253:
gevent/libevent.h:9:10: fatal error: 'event.h' file not found
#include "event.h"
^
1 error generated.
error: command 'clang' failed with exit status 1

这个时候需要安装 =libevent=:

1
brew install libevent

然后安装 =gevent=

1
sudo pip install gevent

安装成功之后,测试一下发现会出错:

1
2
3
4
5
>>> import gevent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/gevent/__init__.py", line 40, in <module>
ImportError: cannot import name core

原来是因为没有安装 =cython=, 安装之

1
sudo pip install cython

并重新安装 =greenlet= 和 =gevent=

1
2
3
4
sudo pip uninstall gevent
sudo pip uninstall greenlet
sudo pip install greenlet
sudo pip install gevent

知识共享授权条款
本著作Chen, Zai-Chun制作,以知识共享 姓名标示-相同方式分享 4.0 国际 授权条款释出

留言

Jun 23 2013