ubuntu14安装scrapy

按照官方文档的说明,安装scrapy 需要以下程序或者库:

(1)、Python 2.7

(2)、lxml。 Most linux distributions ships PRepackaged versions of lxml. Otherwise refer tohttp://lxml.de/installation.html

(3)、OpenSSL。 This comes preinstalled in all Operating systems except Windows (see Platform specific installation notes)

(4)、pip or easy_install Python package managers

我们安装的Ubuntu14.01系统都已经自带了前面3个,Python的版本为2.7.6。为了验证是否有安装,我们来查看一下。

打开终端,执行如下命令python, 接下来就是import lxml, import OpenSSL。如下图。如果import没有报错,说明系统已经自带了。

ubuntu14安装scrapy

 

  1. 为了能够保证下面的安装能够成功。我们先执行:sudo apt-get install python-dev。如图:

    ubuntu14安装scrapy

  2. 再执行:sudo apt-get install libevent-dev。如图:

    ubuntu14安装scrapy

  3. 在这里说明一下,不安装上面两个可能会出现一些错误,导致在后面的工作无法进行。

  4. 接下来就是安装pip了,执行:apt-get install python-pip。如图:

    ubuntu14安装scrapy

  5. 最后,也就是最重要的,安装Scrapy。执行:pip install Scrapy,如图:

    ubuntu14安装scrapy

  6. 到这里就已经安装完成了。接下来就是使用这个框架了。