为什么我不能安装python-Scrapy?

时间:2017-10-26 18:01:18

标签: python linux scrapy

我是一个新手Vagrant用户,并且有一个可靠的64盒子。我这样做:

sudo apt-get install -y python-pip
sudo pip install --upgrade setuptools

Then this happens.

Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 7, in <module>
    from scrapy.cmdline import execute
  File "/usr/local/lib/python2.7/dist-packages/scrapy/__init__.py", line 34, in <module>
    from scrapy.spiders import Spider
  File "/usr/local/lib/python2.7/dist-packages/scrapy/spiders/__init__.py", line 10, in <module>
    from scrapy.http import Request
  File "/usr/local/lib/python2.7/dist-packages/scrapy/http/__init__.py", line 11, in <module>
    from scrapy.http.request.form import FormRequest
  File "/usr/local/lib/python2.7/dist-packages/scrapy/http/request/form.py", line 11, in <module>
    import lxml.html
ImportError: No module named lxml.html`

我到底在这做什么?首先,我尝试通过pip3进行安装,但后来读到Twisted是2.我怎么才能做到这一点?

UPDATE ::: @Paula:所以我用

破坏并初始化它
sudo apt-get install -y python-dev libxml2-dev libxslt1-dev zlib1g-dev python-pip
sudo pip install --upgrade setuptools
sudo pip install Scrapy

在SCRAPY安装上,我不止一次打印到我这里:

x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 4

那怎么样?

1 个答案:

答案 0 :(得分:0)

你需要先运行它。

sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev

正如@Cfreak所说,你有未满足的库依赖。