【问题标题】:Installing scrapy failing on cleaning安装scrapy在清洁时失败
【发布时间】:2014-06-12 12:35:28
【问题描述】:

我一直在尝试使用 pip 安装 Scrapy,以获取本赛季的 NBA 赛程和得分。在过去的 6 个小时里一直在努力尝试安装它。我已逐字按照设置说明进行操作,但仍然无法使其正常工作。任何帮助将不胜感激。终端窗口输出如下。非常感谢!顺便说一句,使用 mac osx。

Requirement already satisfied (use --upgrade to upgrade): Scrapy in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Scrapy-0.22.2-py2.7.egg
Downloading/unpacking Twisted>=10.0.0 (from Scrapy)
  Downloading Twisted-13.2.0.tar.bz2 (2.7MB): 2.7MB downloaded
  Running setup.py (path:/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/Twisted/setup.py) egg_info for package Twisted

Downloading/unpacking w3lib>=1.2 (from Scrapy)
  Downloading w3lib-1.5.tar.gz
  Running setup.py (path:/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/w3lib/setup.py) egg_info for package w3lib

Downloading/unpacking queuelib (from Scrapy)
  Downloading queuelib-1.1.1.tar.gz
  Running setup.py (path:/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/queuelib/setup.py) egg_info for package queuelib

Downloading/unpacking lxml (from Scrapy)
  Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded
  Running setup.py (path:/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/lxml/setup.py) egg_info for package lxml
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.3.5.
    Building without Cython.
    Using build configuration of libxslt 1.1.28

    warning: no previously-included files found matching '*.py'
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyOpenSSL-0.14-py2.7.egg (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cssselect-0.9.1-py2.7.egg (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/six-1.6.1-py2.7.egg (from Scrapy)
Downloading/unpacking zope.interface>=3.6.0 (from Twisted>=10.0.0->Scrapy)
  Downloading zope.interface-4.1.1.tar.gz (864kB): 864kB downloaded
  Running setup.py (path:/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/zope.interface/setup.py) egg_info for package zope.interface

    warning: no previously-included files matching '*.dll' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
Downloading/unpacking cryptography>=0.2.1 (from pyOpenSSL->Scrapy)
  Downloading cryptography-0.3.tar.gz (208kB): 208kB downloaded
  Running setup.py (path:/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/cryptography/setup.py) egg_info for package cryptography
    OS/X: confusion between 'cc' versus 'gcc' (see issue 123)
    will not use '__thread' in the C code
    c/_cffi_backend.c:14:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>
             ^
    1 error generated.
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/cryptography/setup.py", line 156, in <module>
        "test": PyTest,
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "build/bdist.macosx-10.6-intel/egg/setuptools/dist.py", line 239, in __init__
      File "build/bdist.macosx-10.6-intel/egg/setuptools/dist.py", line 264, in fetch_build_eggs
      File "build/bdist.macosx-10.6-intel/egg/pkg_resources.py", line 620, in resolve
      File "build/bdist.macosx-10.6-intel/egg/pkg_resources.py", line 858, in best_match
      File "build/bdist.macosx-10.6-intel/egg/pkg_resources.py", line 870, in obtain
      File "build/bdist.macosx-10.6-intel/egg/setuptools/dist.py", line 314, in fetch_build_egg
      File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 593, in easy_install
      File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 623, in install_item
      File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 811, in install_eggs
      File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 1017, in build_and_install
      File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 1005, in run_setup
    distutils.errors.DistutilsError: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1
    Complete output from command python setup.py egg_info:
    OS/X: confusion between 'cc' versus 'gcc' (see issue 123)

will not use '__thread' in the C code

c/_cffi_backend.c:14:10: fatal error: 'ffi.h' file not found

#include <ffi.h>

         ^

1 error generated.

Traceback (most recent call last):

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

  File "/private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/cryptography/setup.py", line 156, in <module>

    "test": PyTest,

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "build/bdist.macosx-10.6-intel/egg/setuptools/dist.py", line 239, in __init__

  File "build/bdist.macosx-10.6-intel/egg/setuptools/dist.py", line 264, in fetch_build_eggs

  File "build/bdist.macosx-10.6-intel/egg/pkg_resources.py", line 620, in resolve

  File "build/bdist.macosx-10.6-intel/egg/pkg_resources.py", line 858, in best_match

  File "build/bdist.macosx-10.6-intel/egg/pkg_resources.py", line 870, in obtain

  File "build/bdist.macosx-10.6-intel/egg/setuptools/dist.py", line 314, in fetch_build_egg

  File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 593, in easy_install

  File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 623, in install_item

  File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 811, in install_eggs

  File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 1017, in build_and_install

  File "build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py", line 1005, in run_setup

distutils.errors.DistutilsError: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/22/642hcs8n6sx5xg59phv8rw2c0000gn/T/pip_build_andrew/cryptography
Storing debug log for failure in /Users/andrew/.pip/pip.log

【问题讨论】:

    标签: python macos python-2.7 installation scrapy


    【解决方案1】:

    按照以下步骤操作:

    首先安装密码学:

    brew install pkg-config libffi
    export CFLAGS=-Qunused-arguments
    export CPPFLAGS=-Qunused-arguments
    export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
    pip install cryptography
    

    然后使用以下命令安装 lxml:

    xcode-select --install
    

    然后使用以下命令安装scrapy:

    pip install Scrapy
    

    easy_install Scrapy
    

    来源:

    1. Error installing bcrypt with pip on OS X: can't find ffi.h (libffi is installed)

    2. Cannot install Lxml on Mac os x 10.9

    3. http://doc.scrapy.org/en/latest/intro/install.html#requirements

    【讨论】:

      【解决方案2】:

      我在安装密码学时遇到了同样的问题。安装 xcode 命令行工具为我解决了这个问题:

      $xcode-select --install

      $sudo pip 安装密码学

      【讨论】:

        【解决方案3】:

        我无法在本地重现您的问题,但我的建议是卸载 Scrapy,安装依赖项(加密),然后再次尝试安装 Scrapy。

        pip uninstall scrapy
        pip install cryptography
        pip install scrapy
        

        如果仍然对您不起作用,请尝试使用 HomeBrew 或 MacPorts 安装 OpenSSL,然后 follow these steps 告诉加密包使用您系统上已安装的 OpenSSL 版本。

        【讨论】:

          猜你喜欢
          • 2014-07-31
          • 2012-06-11
          • 1970-01-01
          • 2014-05-08
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-10-09
          相关资源
          最近更新 更多