网页抓取神器scrapy的安装搭建

1,安装pyhton2.7.x
#wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
#tar xvf Python-2.7.3.tgz
#cd Python-2.7.3
#./configure
#make && make install

验证python

[root@~]# python
Python 2.7.3 (default, Feb 28 2013, 03:08:43) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
2,安装setuptools

http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz

#wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
#tar zxvf setuptools-0.6c11.tar.gz 
#cd setuptools-0.6c11
#python2.7 setup.py  install
3,安装Twisted
#cd setuptools-0.6c11
#easy_install Twisted
4,安装w3lib
#cd setuptools-0.6c11
#easy_install w3lib
5,安装libxml2或者用easy_install安装lxml
#cd setuptools-0.6c11
#easy_install lxml

验证lxml安装

[root@~]# python
Python 2.7.3 (default, Feb 28 2013, 03:08:43) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
>>> exit()
6,安装pyOpenSSL(这个是可选安装的,主要为了使scrapy能够支持https)
#wget http://launchpadlibrarian.net/58498441/pyOpenSSL-0.11.tar.gz
#tar zxvf pyOpenSSL-0.11.tar.gz 
#cd pyOpenSSL-0.11
#python setup.py install
7,安装pip
#cd setuptools-0.6c11
#easy_install pip
8,pip安装scrapy
#pip install scrapy

验证安装

[root@~]# scrapy
Scrapy 0.16.4 - no active project

Usage:
  scrapy <command> [options] [args]

Available commands:
  fetch         Fetch a URL using the Scrapy downloader
  runspider     Run a self-contained spider (without creating a project)
  settings      Get settings values
  shell         Interactive scraping console
  startproject  Create new project
  version       Print Scrapy version
  view          Open URL in browser, as seen by Scrapy

  [ more ]      More commands available when run from project directory

Use "scrapy <command> -h" to see more info about a command
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值