簡體   English   中英

無法安裝gevent OSX 10.11

[英]Can't install gevent OSX 10.11

嘗試使用Homebrew在OSX 10.11最新的公共測試版上安裝gevent。 運行安裝時,它輸出以下錯誤(抱歉代碼大牆,不確定錯誤的確切位置)

    clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I /opt/local/include -L /opt/local/lib -U__llvm__ -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.11-x86_64-2.7/libev -Ilibev -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.11-x86_64-2.7/gevent/gevent.core.o
  clang: warning: argument unused during compilation: '-L/opt/local/lib'
  In file included from gevent/gevent.core.c:249:
  In file included from gevent/libev.h:2:
  libev/ev.c:483:48: warning: '/*' within block comment [-Wcomment]
  /*#define MIN_INTERVAL  0.00000095367431640625 /* 1/2**20, good till 2200 */
                                                 ^
  libev/ev.c:1029:42: error: '_Noreturn' keyword must precede function declarator
    ecb_inline void ecb_unreachable (void) ecb_noreturn;
                                           ^~~~~~~~~~~~
    _Noreturn
  libev/ev.c:832:26: note: expanded from macro 'ecb_noreturn'
    #define ecb_noreturn   _Noreturn
                           ^
  libev/ev.c:1625:31: warning: 'extern' variable has an initializer [-Wextern-initializer]
    EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
                                ^
  libev/ev.c:1796:7: warning: unused variable 'ocur_' [-Wunused-variable]
        array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2);
        ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:1807:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:1934:7: warning: unused variable 'ocur_' [-Wunused-variable]
        array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2);
        ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  In file included from gevent/gevent.core.c:249:
  In file included from gevent/libev.h:2:
  In file included from libev/ev.c:2484:
  libev/ev_kqueue.c:50:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (struct kevent, kqueue_changes, kqueue_changemax, kqueue_changecnt, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  In file included from gevent/gevent.core.c:249:
  In file included from gevent/libev.h:2:
  In file included from libev/ev.c:2490:
  libev/ev_poll.c:66:7: warning: unused variable 'ocur_' [-Wunused-variable]
        array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2);
        ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:3648:34: warning: '&' within '|' [-Wbitwise-op-parentheses]
    fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
                         ~~~~~~~~~~^~~~~~~~~~~~~ ~
  libev/ev.c:3648:34: note: place parentheses around the '&' expression to silence this warning
    fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
                                   ^
                         (                      )
  libev/ev.c:3687:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:4367:5: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2);
      ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:4407:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:4445:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:4592:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  libev/ev.c:4675:3: warning: unused variable 'ocur_' [-Wunused-variable]
    array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2);
    ^
  libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
        int ecb_unused ocur_ = (cur);                                     \
                       ^
  14 warnings and 1 error generated.
  error: command 'clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for gevent
Failed to build gevent
Installing collected packages: gevent
  Running setup.py install for gevent
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-build-3zCPVx/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-9VpZCX-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    running build_ext
    building 'gevent.core' extension
    clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I /opt/local/include -L /opt/local/lib -U__llvm__ -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.11-x86_64-2.7/libev -Ilibev -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.11-x86_64-2.7/gevent/gevent.core.o
    clang: warning: argument unused during compilation: '-L/opt/local/lib'
    In file included from gevent/gevent.core.c:249:
    In file included from gevent/libev.h:2:
    libev/ev.c:483:48: warning: '/*' within block comment [-Wcomment]
    /*#define MIN_INTERVAL  0.00000095367431640625 /* 1/2**20, good till 2200 */
                                                   ^
    libev/ev.c:1029:42: error: '_Noreturn' keyword must precede function declarator
      ecb_inline void ecb_unreachable (void) ecb_noreturn;
                                             ^~~~~~~~~~~~
      _Noreturn
    libev/ev.c:832:26: note: expanded from macro 'ecb_noreturn'
      #define ecb_noreturn   _Noreturn
                             ^
    libev/ev.c:1625:31: warning: 'extern' variable has an initializer [-Wextern-initializer]
      EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
                                  ^
    libev/ev.c:1796:7: warning: unused variable 'ocur_' [-Wunused-variable]
          array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2);
          ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:1807:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:1934:7: warning: unused variable 'ocur_' [-Wunused-variable]
          array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2);
          ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    In file included from gevent/gevent.core.c:249:
    In file included from gevent/libev.h:2:
    In file included from libev/ev.c:2484:
    libev/ev_kqueue.c:50:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (struct kevent, kqueue_changes, kqueue_changemax, kqueue_changecnt, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    In file included from gevent/gevent.core.c:249:
    In file included from gevent/libev.h:2:
    In file included from libev/ev.c:2490:
    libev/ev_poll.c:66:7: warning: unused variable 'ocur_' [-Wunused-variable]
          array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2);
          ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:3648:34: warning: '&' within '|' [-Wbitwise-op-parentheses]
      fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
                           ~~~~~~~~~~^~~~~~~~~~~~~ ~
    libev/ev.c:3648:34: note: place parentheses around the '&' expression to silence this warning
      fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
                                     ^
                           (                      )
    libev/ev.c:3687:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:4367:5: warning: unused variable 'ocur_' [-Wunused-variable]
        array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2);
        ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:4407:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:4445:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:4592:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    libev/ev.c:4675:3: warning: unused variable 'ocur_' [-Wunused-variable]
      array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2);
      ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize'
          int ecb_unused ocur_ = (cur);                                     \
                         ^
    14 warnings and 1 error generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-build-3zCPVx/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-9VpZCX-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-build-3zCPVx/gevent

使用CFLAGS='-std=c99' pip install gevent來解決這個問題。

在OS X 10.11上,clang使用c11作為默認值,所以只需將其轉回c99即可。

我在我的OSX 10.10.5上遇到了同樣的問題,試圖安裝flask-socketio ,它有gevent作為依賴,但是:

sudo CFLAGS='-std=c99' pip install flask-socketio

給我

Successfully installed flask-socketio-0.6.0 gevent-1.0.2 gevent-socketio-0.3.6 gevent-websocket-0.9.5

所以,tonicbupt的答案也適用於此。

我浪費了兩天的時間和Mac用戶的以下解決方案......

pip install gevent==1.1b5

解決方案: gevent無法安裝在OS X Capitan上的python虛擬環境中

在Mac OS X El Capitan上,我必須完成前面答案中提到的兩件事,設置CFLAGS變量並降級gevent,但我不得不使用1.0版來清除編譯器錯誤。

CFLAGS='-std=c99' pip install gevent==1.0

如其PyPI指令中所述

pip install --pre gevent

應安裝適用於OS X 10.11的發布候選版本( 1.1rc4 2016年2月22日的1.1rc4 )。

此時,gevent 1.1.0 final以OS X的二進制輪形式發布,pip將默認安裝它。 用於OS X的gevent 1.0.2的二進制輪也可用於那些無法升級到較新版本的輪。 這兩個版本都已經過測試,可以安裝在OS X 10.11上,使用Apple發布的Python 2.6和2.7,以及從python.org下載的2.7 Python。 (如果您在安裝二進制輪子時遇到問題,則可能需要更新您的pip版本。)

因此,除非必須從源代碼編譯1.0.2,否則不應再需要設置任何特殊的CFLAGS。 (1.1.0沒有遇到這個問題。)

請注意,輪子是為Python的“窄”unicode構建而分發的,因此如果您使用的是“寬”構建,則需要從源代碼編譯。 在這種情況下,gevent 1.0.2(但不是1.1.0)需要設置CFLAGS =“ - std = c99”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM