码迷,mamicode.com
首页 > 其他好文 > 详细

SCRAPY配置

时间:2017-07-08 21:02:27      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:scrapy

    1  yum groupinstall "Development tools"

    2  yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel

    

       wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
       tar vxf Python-2.7.11.tgz

    6  cd Python-2.7.11

    8  ./configure --prefix=/usr/local

    9  make && make install

   10  python -V

      wget  https://bootstrap.pypa.io/get-pip.py --no-check-certificate

   11  python get-pip.py

   

    wget https://pypi.python.org/packages/ff/d4/209f4939c49e31f5524fa0027bf1c8ec3107abaf7c61fdaad704a648c281/setuptools-21.0.0.tar.gz#md5=81964fdb89534118707742e6d1a1ddb4 --no-check-certificate

   21  tar zxvf setuptools-21.0.0.tar.gz 

   23  cd setuptools-21.0.0

   24  python setup.py install

   25  pip install scrapy

   26  cat > myspider.py <<EOF

from scrapy import Spider, Item, Field

class Post(Item):

    title = Field()


class BlogSpider(Spider):

    name, start_urls = ‘blogspider‘, [‘http://www.cnblogs.com/rwxwsblog/‘]


    def parse(self, response):

        return [Post(title=e.extract()) for e in response.css("h2 a::text")]


EOF


   27  scrapy runspider myspider.py

   scrapy startproject gl


本文出自 “10700016” 博客,请务必保留此出处http://10710016.blog.51cto.com/10700016/1945483

SCRAPY配置

标签:scrapy

原文地址:http://10710016.blog.51cto.com/10700016/1945483

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!