Python 安装scrapy时出错

Python 安装scrapy时出错,python,scrapy,pip,gnu,Python,Scrapy,Pip,Gnu,我只是试着运行一个简单的 sudo pip install scrapy 在下载每个组件后,它会给我一个错误: Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-s37cTl/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __fi

我只是试着运行一个简单的

sudo pip install scrapy
在下载每个组件后,它会给我一个错误:

Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-s37cTl/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-62NAJB-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-s37cTl/cffi
我满足了所有的依赖,不知道能做什么。 我运行Debian7

谢谢

编辑:我粘贴整个安装终端输出:

 :~$ sudo pip install scrapy
    Collecting scrapy
  Using cached Scrapy-0.24.5-py2-none-any.whl
Collecting cssselect>=0.9 (from scrapy)
  Using cached cssselect-0.9.1.tar.gz
Collecting queuelib (from scrapy)
  Using cached queuelib-1.2.2-py2.py3-none-any.whl
Collecting pyOpenSSL (from scrapy)
  Using cached pyOpenSSL-0.14.tar.gz
Collecting w3lib>=1.8.0 (from scrapy)
  Using cached w3lib-1.11.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/local/lib/python2.7/dist-packages (from scrapy)
Collecting Twisted>=10.0.0 (from scrapy)
  Using cached Twisted-15.0.0.tar.bz2
Collecting six>=1.5.2 (from scrapy)
  Using cached six-1.9.0-py2.py3-none-any.whl
Collecting cryptography>=0.2.1 (from pyOpenSSL->scrapy)
  Using cached cryptography-0.8.tar.gz
Collecting zope.interface>=3.6.0 (from Twisted>=10.0.0->scrapy)
  Using cached zope.interface-4.1.2.tar.gz
Collecting pyasn1 (from cryptography>=0.2.1->pyOpenSSL->scrapy)
  Using cached pyasn1-0.1.7.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.2.1->pyOpenSSL->scrapy)
Collecting enum34 (from cryptography>=0.2.1->pyOpenSSL->scrapy)
  Using cached enum34-1.0.4.tar.gz
Collecting cffi>=0.8 (from cryptography>=0.2.1->pyOpenSSL->scrapy)
  Using cached cffi-0.9.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=0.8->cryptography>=0.2.1->pyOpenSSL->scrapy)
Installing collected packages: cffi, enum34, pyasn1, zope.interface, cryptography, six, Twisted, w3lib, pyOpenSSL, queuelib, cssselect, scrapy
  Running setup.py install for cffi
    building '_cffi_backend' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-i686-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-tIHlcr/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dPM9YP-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_py

    creating build

    creating build/lib.linux-i686-2.7

    creating build/lib.linux-i686-2.7/cffi

    copying cffi/lock.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/model.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/api.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/vengine_gen.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/gc_weakref.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/vengine_cpy.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/verifier.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/ffiplatform.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/__init__.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/cparser.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/commontypes.py -> build/lib.linux-i686-2.7/cffi

    copying cffi/backend_ctypes.py -> build/lib.linux-i686-2.7/cffi

    running build_ext

    building '_cffi_backend' extension

    creating build/temp.linux-i686-2.7

    creating build/temp.linux-i686-2.7/c

    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-i686-2.7/c/_cffi_backend.o

    c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory

    compilation terminated.

    error: command 'gcc' failed with exit status 1

    ----------------------------------------
    Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-tIHlcr/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dPM9YP-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-tIHlcr/cffi

在Mint 17上,我可以在安装以下软件包后安装Scrapy:

sudo apt-get install libffi-dev libssl-dev libxml2-dev libxslt1-dev
半个世纪

yum install libffi libffi-devel
然后


你能提供追踪吗?您可以在这里尝试解决方案,并告知结果,我安装了python dev,但没有安装libevent-dev。我安装了它,现在它可以工作了,我不确定这是用于libevent还是用于libffi dev,非常感谢,一切都很好!我缺少libffi开发包,不知道它是必需的(我想他们应该更新需求页面)。现在效果很好,谢谢!sudo-apt-get-install-python-dev.@kolba329您关于同时安装包
python-dev
的提示最终使我在Lubuntu 14.04上处理类似的基于ffi/cffi的pip安装问题时工作正常;谢谢
pip install cffi
pip install Scrapy