我只是试着运行一个简单的
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
我满足所有的家属,不知道可以做什么。 我运行Debian 7。
谢谢!
编辑:我粘贴整个安装终端输出:
:~$ 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
答案 0 :(得分:2)
在Mint 17上,我可以在安装以下软件包之后安装Scrapy:
sudo apt-get install libffi-dev libssl-dev libxml2-dev libxslt1-dev
答案 1 :(得分:1)
对于CentOS
yum install libffi libffi-devel
然后
pip install cffi
pip install Scrapy