pip를 사용하여 virtualenv에서 scrapy 설치 오류


47
pip install scrapy
Downloading/unpacking scrapy
  Downloading Scrapy-0.24.2-py2-none-any.whl (502kB): 502kB downloaded
Downloading/unpacking pyOpenSSL (from scrapy)
  Downloading pyOpenSSL-0.14.tar.gz (128kB): 128kB downloaded
  Running setup.py (path:/home/elie/.virtualenvs/stat/build/pyOpenSSL/setup.py) egg_info for package pyOpenSSL

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    no previously-included directories found matching 'doc/_build'
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /home/elie/.virtualenvs/stat/lib/python2.7/site-packages (from scrapy)
Downloading/unpacking queuelib (from scrapy)
  Downloading queuelib-1.1.1.tar.gz
  Running setup.py (path:/home/elie/.virtualenvs/stat/build/queuelib/setup.py) egg_info for package queuelib

Requirement already satisfied (use --upgrade to upgrade): lxml in /home/elie/.virtualenvs/stat/lib/python2.7/site-packages (from scrapy)
Downloading/unpacking w3lib>=1.2 (from scrapy)
  Downloading w3lib-1.6.tar.gz
  Running setup.py (path:/home/elie/.virtualenvs/stat/build/w3lib/setup.py) egg_info for package w3lib

Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /home/elie/.virtualenvs/stat/lib/python2.7/site-packages (from scrapy)
Downloading/unpacking Twisted>=10.0.0 (from scrapy)
  Downloading Twisted-14.0.0.tar.bz2 (4.3MB): 4.3MB downloaded
  Running setup.py (path:/home/elie/.virtualenvs/stat/build/Twisted/setup.py) egg_info for package Twisted

Downloading/unpacking cryptography>=0.2.1 (from pyOpenSSL->scrapy)
  Downloading cryptography-0.5.2.tar.gz (319kB): 319kB downloaded
  Running setup.py (path:/home/elie/.virtualenvs/stat/build/cryptography/setup.py) egg_info for package cryptography
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/elie/.virtualenvs/stat/build/cryptography/setup.py", line 174, in <module>
        "test": PyTest,
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/dist.py", line 263, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/pkg_resources.py", line 564, in resolve
        dist = best[req.key] = env.best_match(req, self, installer)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/pkg_resources.py", line 802, in best_match
        return self.obtain(req, installer) # try and download/install
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/pkg_resources.py", line 814, in obtain
        return installer(requirement)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 593, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 809, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1015, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1003, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

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

 #include <ffi.h>

                 ^

compilation terminated.

Traceback (most recent call last):

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

  File "/home/elie/.virtualenvs/stat/build/cryptography/setup.py", line 174, in <module>

    "test": PyTest,

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/dist.py", line 239, in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/dist.py", line 263, in fetch_build_eggs

    parse_requirements(requires), installer=self.fetch_build_egg

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/pkg_resources.py", line 564, in resolve

    dist = best[req.key] = env.best_match(req, self, installer)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/pkg_resources.py", line 802, in best_match

    return self.obtain(req, installer) # try and download/install

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/pkg_resources.py", line 814, in obtain

    return installer(requirement)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_egg

    return cmd.easy_install(req)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 593, in easy_install

    return self.install_item(spec, dist.location, tmpdir, deps)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in install_item

    dists = self.install_eggs(spec, download, tmpdir)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 809, in install_eggs

    return self.build_and_install(setup_script, setup_base)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1015, in build_and_install

    self.run_setup(setup_script, setup_base, args)

  File "/home/elie/.virtualenvs/stat/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1003, in run_setup

    raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/elie/.virtualenvs/stat/build/cryptography
Storing debug log for failure in /home/elie/.pip/pip.log

전에 스크래피를 설치했는데 문제가 없었습니다. 무엇이 잘못 되었나요?


@hbdgaf 나는 그것을 지금 설치했고 또 다른 문제가
생겼다

@hbdgaf 여기에 새로운 오류 pastebin.com/cpCRDVxH
Lynob

@hbdgaf가 있음을했고, 그것을 고정, 당신이 말한 것을의 Separate question then. Or you could try chat.나는 오류를 표시해야합니다 생각 그래서, 당신은 알고 신경 쓸 것,
Lynob

@hbdgaf 좋아, 다음 번에, 나는 종종 여기에 게시하는 대화방에 실제로 사용되지 않아야하는 경우에 그런 질문을 할 것이다.
Lynob

@hbdgaf는 그들을 태워 버릴 수 있습니다, 나는 질문을 삭제하고 싶었지만 대답을 잃어버린 답변을 한 사용자에게는 원하지 않습니다
Lynob

답변:


83

이 오류도 발생했습니다. 문제는

 No package 'libffi' found
 c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
 #include <ffi.h>

이 작업을 수행해야합니다.

sudo apt-get install libffi-dev

11
그것을 시도하고 나도 libssl-dev를 설치해야했다
Lynob

시도하는 동안 그 문제가 pip3 install cairocffi있습니다. 그것을 해결했다. 감사합니다!
Martin Thoma

2
아마존 리눅스 :sudo yum install libffi-devel
존 Rotenstein

12

14.04를 새로 설치 한 후에는 python-dev, libffi-dev, libssl-dev, libxml2-dev 및 libxslt1-dev 패키지를 설치해야했습니다. 일단 설치되면 pip install scrapy정상적으로 작동했습니다.

sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev
pip install scrapy

이 오류가 발생합니다 :`---------------------------------------- Command "/ usr / bin / python -u -c "설정 도구 가져 오기, 토큰 화; __ file __ = '/ tmp / pip-build-0R1XKL / lxml / setup.py'; exec (compile (getattr (tokenize, 'open', open) ( file )) .read (). replace ( '\ r \ n', '\ n'), file , 'exec')) "install --record /tmp/pip-pip-T9Uhnd-record/install-record.txt --single- version-externally-managed --compile "이 / tmp / pip-build-0R1XKL / lxml /의 오류 코드 1과 함께 실패했습니다.
Nhu Vy

이것은 내 전체 로그입니다 : gist.github.com/donhuvy/1cc55b4ed6a5c8a6e458fce62c51e337은 내가 CentOS는 7 scrapy를 설치하려고 - 64
마 Nhu는 VY

0

다음 두 명령을 사용하여 scrapy를 설치했습니다.

sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev

sudo apt-get install python-scrapy

스크랩의 버전을 확인하여

scrapy -V
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.