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
时间: 2024-11-06 22:22:59