0

我尝试在最后几个小时在我的 mac 10.8 上安装 grequests。

pip install我得到:

$ pip install grequests
Requirement already satisfied (use --upgrade to upgrade): grequests in /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages
Downloading/unpacking gevent (from grequests)
  Running setup.py egg_info for package gevent
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/private/var/folders/hx/_6mzcrld6777n9mfkx7g9dmc0000gp/T/pip-build-ddl449/gevent/setup.py", line 95
        print 'Linking %s to %s' % (path_to_build_core_so, path_to_core_so)
                               ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/private/var/folders/hx/_6mzcrld6777n9mfkx7g9dmc0000gp/T/pip-build-ddl449/gevent/setup.py", line 95

    print 'Linking %s to %s' % (path_to_build_core_so, path_to_core_so)

                           ^

SyntaxError: invalid syntax

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /private/var/folders/hx/_6mzcrld6777n9mfkx7g9dmc0000gp/T/pip-build-ddl449/gevent
Storing complete log in /Users/ddl449/.pip/pip.log

这似乎是一个gevent安装问题,因为我在使用时遇到了同样的错误:

 pip install gevent #same with pip-3.2

所以我去看看如何手动安装 gevent 。我将其视为先决条件greenlet

pip install它,但我得到:

lipo: can't figure out the architecture type of: /var/folders/hx/_6mzcrld6777n9mfkx7g9dmc0000gp/T//ccRlrUpW.out
error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1

但是我有 GCC:

$ gcc
i686-apple-darwin11-llvm-gcc-4.2: no input files

也许我把 GCC 搞砸了。

还:

$ sudo port install py-greenlet
Error: Port py-greenlet not found

所以,这就是我走了多远。有任何想法吗?

更新:

我通过简单地编译 tarball 来解决 GCC 错误python setup.py build install。虽然我安装了 Cython,但在尝试安装gevent构建的 tarball 时出现错误。

$ sudo python3.3 setup.py install
running install
running bdist_egg
running egg_info
writing requirements to gevent.egg-info/requires.txt
writing dependency_links to gevent.egg-info/dependency_links.txt
writing top-level names to gevent.egg-info/top_level.txt
writing gevent.egg-info/PKG-INFO
reading manifest file 'gevent.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile.ext'
writing manifest file 'gevent.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
running build_py
running build_ext
/usr/local/bin/python3.3 util/cythonpp.py -o gevent.core.c gevent/core.ppyx
Running cython -o gevent.core.c gevent/core.pyx  # !EV_USE_SIGNALFD && !defined(LIBEV_EMBED) && !defined(_WIN32)
sh: cython: command not found
Traceback (most recent call last):
  File "util/cythonpp.py", line 801, in <module>
    process_filename(filename, options.output_file)
  File "util/cythonpp.py", line 85, in process_filename
    output = run_cython(pyx_filename, sourcehash, output_filename, banner, comment)
  File "util/cythonpp.py", line 529, in run_cython
    system(command, comment)
  File "util/cythonpp.py", line 539, in system
    raise AssertionError('%r failed with code %s' % (command, result))
AssertionError: 'cython -o gevent.core.c gevent/core.pyx' failed with code 32512
make: *** [gevent/gevent.core.c] Error 1
4

1 回答 1

0

好的,这就是我所做的一切。我清除了 /usr/local/bin 中的 GCC。现在它在 /usr/bin 中。我使用了 ggc 安装程序包,我不知道这是否有帮助,但我做到了。

我更新到 2.7.5(我有 2.7.2)和pip install cython. 我被安装了。与gevent和相同grequest。并做了。

但是gevent,也许cython似乎在 python 3.3 中出现了问题。

于 2013-07-25T22:30:50.647 回答