【问题标题】:gcc-4.0 failed on mac 10.6.8 while installing Scrapy how can i overcome this?gcc-4.0 在安装 Scrapy 时在 mac 10.6.8 上失败了我该如何克服这个问题?
【发布时间】:2011-11-12 16:46:30
【问题描述】:

我在我的 mac 10.6.8 上使用了 pip install Scrapy,但出现以下错误 谁能帮帮我?

creating build/lib.macosx-10.3-fat-2.7/twisted/internet/iocpreactor/iocpsupport

copying twisted/internet/iocpreactor/iocpsupport/iocpsupport.c ->
build/lib.macosx-10.3-fat-2.7/twisted/internet/iocpreactor/iocpsupport

copying twisted/internet/iocpreactor/iocpsupport/winsock_pointers.c ->
build/lib.macosx-10.3-fat-2.7/twisted/internet/iocpreactor/iocpsupport

copying twisted/python/_epoll.c ->
build/lib.macosx-10.3-fat-2.7/twisted/python

copying twisted/python/_initgroups.c ->
build/lib.macosx-10.3-fat-2.7/twisted/python

copying twisted/runner/portmap.c ->
build/lib.macosx-10.3-fat-2.7/twisted/runner

copying twisted/test/raiser.c ->
build/lib.macosx-10.3-fat-2.7/twisted/test

running build_ext

gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386
-g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c conftest.c -o conftest.o

/usr/libexec/gcc/powerpc-apple-darwin10/4.0.1/as: assembler
(/usr/bin/../libexec/gcc/darwin/ppc/as or
/usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not
installed

Installed assemblers are:

/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64

/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

lipo: can't open input file:
/var/folders/jk/jkTyAFDWEC8fvZts+C7Jwk+++TI/-Tmp-//ccBIdB4l.out (No
such file or directory)

gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386
-g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c conftest.c -o conftest.o

conftest.c:1:23: error: sys/epoll.h: No such file or directory

conftest.c:1:23: error: sys/epoll.h: No such file or directory

lipo: can't figure out the architecture type of:
/var/folders/jk/jkTyAFDWEC8fvZts+C7Jwk+++TI/-Tmp-//cceIymsT.out

building 'twisted.test.raiser' extension

creating build/temp.macosx-10.3-fat-2.7

creating build/temp.macosx-10.3-fat-2.7/twisted

creating build/temp.macosx-10.3-fat-2.7/twisted/test

gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386
-g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c twisted/test/raiser.c -o build/temp.macosx-10.3-fat-2.7/twisted/test/raiser.o

In file included from /usr/include/architecture/i386/math.h:626,

                 from /usr/include/math.h:28,

                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,

                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,

                 from twisted/test/raiser.c:4:

/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building
for Intel with Mac OS X Deployment Target < 10.4 is invalid.

/usr/libexec/gcc/powerpc-apple-darwin10/4.0.1/as: assembler
(/usr/bin/../libexec/gcc/darwin/ppc/as or
/usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not
installed

Installed assemblers are:

/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64

/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

lipo: can't open input file:
/var/folders/jk/jkTyAFDWEC8fvZts+C7Jwk+++TI/-Tmp-//ccNvrcyZ.out (No
such file or directory)

error: command 'gcc-4.0' failed with exit status 1

---------------------------------------- Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-c "import setuptools;__file__='/Users/bbb/Dropbox/projects/android/continuous-integration/build/Twisted/setup.py';exec(compile(open(__file__).read().replace('\r\n',
'\n'), __file__, 'exec'))" install --single-version-externally-managed
--record /var/folders/jk/jkTyAFDWEC8fvZts+C7Jwk+++TI/-Tmp-/pip-MXEZuX-record/install-record.txt
failed with error code 1 Storing complete log in
/Users/bbb/.pip/pip.log

【问题讨论】:

    标签: python pip scrapy


    【解决方案1】:

    您似乎已经安装了 Xcode 4,它删除了用于构建您已安装的 Python 2.7 的 gcc-4.0。从回溯中的路径名来看,很可能是从 python.org 下载的仅 32 位 Python。对于 Xcode 4,您应该尝试安装 latest 64-bit/32-bit OS X installer for Python 2.7 from python.org。然后,您可能需要重新安装已安装的任何软件包,例如 Distributepip 和依赖项。根据 Xcode 4 的版本,您可能还需要在运行 pipeasy_install 之前提供以下环境变量设置:

    export CC=gcc
    

    【讨论】:

    • 嗨,我从 python.org 下载了 python27 dmg,然后 pip install Scrapy 我得到了这个:$ pip install Scrapy setuptools;__file__='/Users/bbb/Dropbox/projects/android/continuous -integration/build/Twisted/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), 文件, 'exec'))" install --single-version-externally-managed --record /var/folders/jk/jkTyAFDWEC8fvZts+C7Jwk+++TI/-Tmp-/pip-J88r8N-record/ install-record.txt 失败,错误代码 1 在 /Users/tomerb/.pip/pip.log 中存储完整日志
    • usr/include/AvailabilityMacros.h:108:14:警告:#warning 为 Intel 构建 Mac OS X 部署目标
    • 安装的汇编器是: /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64 /usr/bin/../libexec/gcc/darwin/i386/as for架构 i386 lipo:无法打开输入文件:/var/folders/jk/jkTyAFDWEC8fvZts+C7Jwk+++TI/-Tmp-//ccOTQaBa.out(没有这样的文件或目录)错误:命令“gcc-4.0”失败退出状态为 1
    • 重装Python后有没有安装新版本的Distribute和pip?还是您使用的是virtualenv?从您显示的消息来看,您似乎仍在使用仅 32 位的 Python。当您只键入python 时,显示的解释器版本信息应该是 2.7.2 和 gcc-4.2,而不是 gcc-4.0。然后按照 pip 安装说明进行操作,包括安装 Distribute:pypi.python.org/pypi/pip
    • 您好 1. 安装 python 后我没有安装新的 pip,因为我看到 pip 已经工作了,在这种情况下我还需要重新安装吗? 2. 我有 virtualenv 但在这种情况下我不认为我在使用它,我应该使用它吗?会有帮助吗? 3. 是的,我的电脑是 32 位的,所以我使用 32 位 python(可能只是 32 位...)所以你说我需要重新安装 pip 对吗?
    【解决方案2】:

    pip 安装 python 包。通常这些 python 包依赖于 c 库,这些库应该由你的包管理器安装,而不是由 pip 安装。

    查看输出,您缺少几个包的头文件。我可以发现这些可能还有更多..

    conftest.c:1:23: error: sys/epoll.h: No such file or directory
    
    include/python2.7/pyport.h:312
    

    在 ubuntu 上,它是包管理器中的一个简单外观: python-devepoll-dev 包。但是osx可能有一种简单的方法。

    或者你可以为你的 osx 寻找一个预编译的包。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多