64

Python ライブラリgevent、バージョン 0.13.6 (PyPI の現在のバージョン) はpip install、OS X Lion、Python 2.7 (およびおそらくその他) では機能しません。Snow Leopard では問題なく動作します。

このライブラリをインストールするにはどうすればよいですか?

pip install手動またはカスタム プロセスではなく、を使用して実行できればボーナス ポイントです。自動ビルドでうまく機能するからです。

ここに私のpip install出力があります:

pip install gevent
Downloading/unpacking gevent
  Running setup.py egg_info for package gevent

Requirement already satisfied (use --upgrade to upgrade): greenlet in ./tl_env/lib/python2.7/site-packages (from gevent)
Installing collected packages: gevent
  Running setup.py install for gevent
    building 'gevent.core' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.6-intel-2.7/gevent/core.o
    In file included from gevent/core.c:225:
    gevent/libevent.h:9:19: error: event.h: No such file or directory
    gevent/libevent.h:38:20: error: evhttp.h: No such file or directory
    gevent/libevent.h:39:19: error: evdns.h: No such file or directory
    gevent/core.c:361: error: field ‘ev’ has incomplete type
    gevent/core.c:741: warning: parameter names (without types) in function declaration
    gevent/core.c: In function ‘__pyx_f_6gevent_4core___event_handler’:
    gevent/core.c:1619: error: ‘EV_READ’ undeclared (first use in this function)
    gevent/core.c:1619: error: (Each undeclared identifier is reported only once
    gevent/core.c:15376: warning: assignment makes pointer from integer without a cast
   [... about 1000 more lines of compiler errors...]
    gevent/core.c:15385: error: dereferencing pointer to incomplete type
    gevent/core.c: In function ‘__pyx_pf_6gevent_4core_4http___init__’:
    gevent/core.c:15559: warning: assignment makes pointer from integer without a cast
    gevent/core.c: At top level:
    gevent/core.c:21272: error: expected ‘)’ before ‘val’
    lipo: can't figure out the architecture type of: /var/folders/s5/t94kn0p10hdgxzx9_9sprpg40000gq/T//cczk54q7.out
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/jacob/code/toplevel/tl_env/bin/python -c "import setuptools;__file__='/Users/jacob/code/toplevel/tl_env/build/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/s5/t94kn0p10hdgxzx9_9sprpg40000gq/T/pip-s2hPd3-record/install-record.txt --install-headers /Users/jacob/code/toplevel/tl_env/bin/../include/site/python2.7:
    running install

running build

running build_py

running build_ext

building 'gevent.core' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.6-intel-2.7/gevent/core.o
4

10 に答える 10

114

全部載せるな!それは多すぎる!90% の確率で、最初のエラーで十分です...

gevent/libevent.h:9:19: エラー: event.h: そのようなファイルまたはディレクトリはありません

これは、event.hヘッダーを提供するライブラリがインストールされていないことを意味します。ライブラリは libevent ( website ) と呼ばれます。

一般に、このようなコンパイル エラーはビルド スクリプトの欠陥です。ビルド スクリプトは、libevent がインストールされていないというエラー メッセージを表示するはずですが、そうしなかったのはバグです。

MacPorts から libevent を取得し、pip の実行中CFLAGSに環境変数をevent.h使用してコンパイラに手動で指示します。libevent

sudo port install libevent
CFLAGS="-I /opt/local/include -L /opt/local/lib" pip install gevent

libevent のインストールに自作を使用することもできます: brew install libevent
(David Wolever のコメントから)

于 2011-10-03T01:38:09.350 に答える
24
CFLAGS='-std=c99' pip install gevent

参照: gevent OSX 10.11 をインストールできません

OS X 10.11 では、clang はデフォルトで c11 を使用するため、c99 に戻すだけです。

于 2015-10-30T06:38:06.543 に答える
4

Snow Leopardにインストールするためのヘルプを探しているときにこの答えを見つけました。他の誰かが同じ問題でこのようにやってきた場合に備えて、これを投稿してください。

私はlibeventをmacports経由でインストールしました。

export CFLAGS = -I / opt / local / include export LDFLAGS = -L / opt / local / lib sudo pip install gevent

于 2013-02-23T18:45:22.513 に答える
2

私はbrew経由でlibeventをインストールしましたが、それも失敗しました。

CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib pip install gevent

于 2013-08-27T20:43:32.827 に答える
0

私はvirtualenvとvirtualenvラッパーを使用しているので、これを自己完結型にしたかったのです。私は gevent を次のように動作させました:

仮想環境がセットアップされていると仮定すると、次のようになります。

workon {my_virtual_env}

次に、libevent をダウンロードして、virtualenv に対してインストールします。

curl -L -O https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

tar -xzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix="$VIRTUAL_ENV"
make && make install

gcc 5+がインストールされていると仮定しています(私はbrewを使用しています)

お役に立てれば。

于 2015-09-06T01:58:46.813 に答える
0
sudo pip install cython git+git://github.com/gevent/gevent.git#egg=gevent
于 2015-09-20T08:02:40.647 に答える
0

ソースからすべてをインストールして csh を使用する場合、Mac OS 10.9 で次のように動作します。

  1. 最新の安定版をダウンロードhttp://libevent.org/ libevent-2.0.21-stable

    • 。/構成、設定
    • 作る
    • sudo make install
  2. virtualenv 環境

  3. ソース env/bin/activate.csh

  4. setenv CFLAGS "-I /usr/local/include -L /usr/local/lib"

  5. pip インストール gevent

于 2013-10-26T22:25:55.033 に答える