此文档是本人学习时使用的,采用一个实例作为引导进行安装测试。

  实例下载地址如下:

  https://github.com/sans-serif/scrapy-german-news#introduction

  解压之后为:scrapy-german-news-master

  修改requirements.txt 删除psycopg2==2.6.1

  其中requirements.txt内容如下:

  ********************************************************************

  attrs==15.2.0

  cffi==1.5.2

  cryptography==1.2.3

  cssselect==0.9.1

  enum34==1.1.2

  idna==2.0

  ipaddress==1.0.16

  lxml==3.5.0

  psycopg2==2.6.1

  pyasn1==0.1.9

  pyasn1-modules==0.0.8

  pycparser==2.14

  pyOpenSSL==0.15.1

  queuelib==1.4.2

  Scrapy==1.0.5

  service-identity==16.0.0

  six==1.10.0

  Twisted==15.5.0

  w3lib==1.13.0

  zope.interface==4.1.3

  ********************************************************************

  按理只需此文件即可,scrapy-german-news-master只是测试工程。


具体安装步骤如下:

第一步:

安装pip: sudo apt-get install python-pip

第二步:安装依赖

sudo apt-get install libffi-dev

sudo apt-get install python-dev

sudo apt-get install libxml2-dev

sudo apt-get install libxslt-dev

第三步:

  准备好requirements.txt文件。

  sudo pip install -r requirements.txt

第四步:安装postgresql

sudo apt-get install postgresql

sudo apt-get install python-psycopg2

sudo apt-get install libpq-dev

sudo pip install psycopg2==2.6.1

安装完成

测试运行,看是否安装成功:

  进入目录scrapy-german-news-master 运行 scrapy crawl faz

  如果能看到开始抓取数据,则认为配置成功

  


如安装过程中出现如下错误,解决方案:

(1)ImportError: No module named pkg_resources 解决方法:

  sudo apt-get install --reinstall python-pkg-resources

(2)pkg_resources.DistributionNotFound: setuptools>=11.3 解决方法:

  sudo pip install -U distribute

(3)pip install psycopg2  错误,解决如下:

  sudo apt-get install postgresql

  sudo apt-get install python-psycopg2

  sudo apt-get install libpq-dev

(4)c/_cffi_backend.c:2:20: 致命错误: Python.h:没有那个文件或目录, 解决如下:

  sudo apt-get install python-dev

(5)src/lxml/includes/etree_defs.h:14:31: 致命错误: libxml/xmlversion.h:没有那个文件或目录,解决如下:

  apt-get install libxml2-dev libxslt-dev

(6)关于这个libffi,错误,解决如下:

  sudo apt-get install libffi-dev

(7) build/temp.linux-i686-2.7/_openssl.c:431:25: fatal error: openssl/aes.h: No such file or directory, 解决如下:

  sudo apt-get install libssl-dev

备注:以上测试工程采用的是postgresql数据库,也可以采用mysql

scrapy在ubuntu上安装总结的更多相关文章

  1. [异常解决] ubuntu上安装JLink驱动遇到的坑及给后来者的建议

    一.前言 最近将整个电脑格式化,改成了linux操作系统 希望这样能让自己在一个新的世界探索技术.提升自己吧- win上的工具用多了,就不想变化了- 继上一篇<ubuntu上安装虚拟机遇到的问题 ...

  2. Ubuntu上安装Robomongo及添加到启动器

    到目前为止,Robomongo仍是MongoDB最好的客户端管理工具,如需在Ubuntu上安装Robomongo,可直接从官网下载.tar.gz压缩包进行解压,然后直接运行bin目录下的robomon ...

  3. 在 Ubuntu 上安装 Android Studio

    在 Ubuntu 上安装 Android Studio http://www.linuxidc.com/Linux/2013-05/84812.htm 打开terminal,输入以下命令 sudo a ...

  4. Ubuntu上安装Karma失败对策

    在Ubuntu上安装Karma遇到超时 timeout 错误.Google了一下,国外的码农给了一个快捷的解决方案,实测可行,贴在这里: sudo apt-get install npm nodejs ...

  5. 在Ubuntu上安装LAMP服务器

    1.安装Ubuntu上安装LAMP apt-get install lamp-server^ 2.安装过程中设置MySql密码 3.测试 创建index.php var/www/html/index. ...

  6. [译]How to Setup Sync Gateway on Ubuntu如何在ubuntu上安装sync-gateway

    参考文章https://hidekiitakura.com/2015/03/21/how-to-setup-sync-gateway-on-ubuntudigitalocean/ 在此对作者表示感谢 ...

  7. 在Ubuntu上安装JDK、Ant、Jmeter和Jenkins

    一.前期准备 1. 在win7下载VMware.Ubuntu(用迅雷下比较快) 2. 安装完VMware后新建虚拟机,选择iso: 3. 具体配置参考如下,至此Ubantu安装完成 二.在Ubuntu ...

  8. Ubuntu上安装MongoDB(译)

    add by zhj:直接从第四步开始就可以了,而且安装好MongoDB后会自动启动的,不必自己去执行启动命令 原文:https://docs.mongodb.com/manual/tutorial/ ...

  9. Ubuntu上安装ns2-2.34

    Ubuntu上安装ns2-2.34 步骤1 下载ns-allinone-2.34 $ tar zxf ns-allinone-2.34.tar.gz 步骤2 sudo apt-get install ...

随机推荐

  1. PHP:Cannot modify header information - headers already sent by错误的解决方案

    <?php ob_start();setcookie("username","test",time()+3600);echo "the user ...

  2. 在SSIS中使用自定义的DLL文件

    原文:在SSIS中使用自定义的DLL文件 步骤1.开发dll(需要签名) using System;using System.Collections.Generic;using System.Text ...

  3. .Net中批量更新或添加数据

    方法一:使用SqlBulkCopy实现批量更新或添加数据. SqlBulkCopy类一般只能用来将数据批量插入打数据库中,如果数据表中设置了主键,出现重复数据的话会报错,如果没有设置主键,那么将会添加 ...

  4. DDD领域驱动设计

    DDD领域驱动设计实践篇之如何提取模型 需求说明: 省级用户可以登记国家指标 省级用户和市级用户可以登记指标分解 登记国家指标时,需要录入以下数据:指标批次.文号.面积,这里省略其他数据,下同 登记指 ...

  5. HTTP/1.1与HTTP/1.0的区别

    HTTP/1.1与HTTP/1.0的区别 下面主要从几个不同的方面介绍HTTP/1.0与HTTP/1.1之间的差别,当然,更多的内容是放在解释这种差异背后的机制上. 1 可扩展性 可扩展性的一个重要原 ...

  6. 使用maven+eclipse搭建最简单的struts2的helloworld

    使用maven+eclipse搭建最简单的struts2的helloworld 一.web分层结构简介 1.web[细]粒度分层结构: 按细粒度分层可以分为以下6种: 1).表现层:html/css/ ...

  7. 企业架构研究总结(27)——TOGAF架构开发方法(ADM)之架构变更管理阶段

    1.10 架构变更管理(Architecture Change Management) 企业架构开发方法各阶段——架构变更管理 1.10.1 目标 本阶段的目标是: 确保基线架构持续符合当前实际. 评 ...

  8. MongoDB集群与LBS应用系列(一)

    MongoDB集群与LBS应用系列(一) 1. 概念 MongoDB作为著名的NoSQL,早已非常流行.它的地理应用也非常成熟,被foursquare用于生产环境也已经多时.本文主要记录今年6月份的一 ...

  9. java正则表达式去除html标签

    当我们用ckeditor或其他一些在线文本编辑器的时候 内容里会有很多的标签 如下片段: <p><img alt="" src="/img/upload ...

  10. C#山寨版本拨号客户端

    C#山寨版本[天翼拨号客户端]---内含详细抓包,模拟数据---万事俱备,只欠东风.   本帖子本来最初是发在CSDN上的,回复的也有十几个,但没有一个有技术含量的回复....特来此讨论,请教,请各位 ...