安装scrapy框架

  1. install python2.7
    centos :
    https://github.com/h2oai/h2o/wiki/Installing-python-2.7-on-centos-6.3.-Follow-this-sequence-exactly-for-centos-machine-only
    Or
    yum groupinstall "Development tools"
    yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libxslt-devel libxml2-devel
    cd Python-2.7.*
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    make -j4 && make altinstall
    ln -svf /usr/local/bin/python2.7 /usr/local/bin/python

    suse:
    #!/bin/bash
    # Install Python 2.7.2 alternatively

    zypper install -t pattern sdk_c_c++
    zypper install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel zlib-devel expat-devel libGL-devel tk tix gcc-c++ libX11-devel glibc-devel bzip2     tar tcl-devel tk-devel pkgconfig tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel valgrind-devel
    mkdir tmp
    cd tmp
    wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
    tar xvfz Python-2.7.2.tgz
    cd Python-2.7.2
    ./configure --prefix=/opt/python2.7 --enable-shared
    make -j4 && make altinstall
    echo "/opt/python2.7/lib" >> /etc/ld.so.conf.d/opt-python2.7.conf
    ldconfig
    cd ../..
    rm -rf tmp
    install setuptools:
    https://pypi.python.org/pypi/setuptools#unix-wget

    2. install pip
    https://scrapy-chs.readthedocs.org/zh_CN/0.24/intro/install.html#intro-install
     wget "https://bootstrap.pypa.io/get-pip.py" --no-check-certificate

    python get-pip.py


    3.
    yum install libffi* -y
    install scrapy and start demo

    https://scrapy-chs.readthedocs.org/zh_CN/0.24/intro/tutorial.html
    scrapy crawl demo -o item.json

    4. 模拟浏览器行为
    其一个执行js获取结果,需要清楚js执行逻辑
    其二个模拟浏览器UI动作,获得结果
    其余 (http://www.quora.com/How-can-we-execute-javascript-in-scrapy)
    4_1. scrapyJS
    http://splash.readthedocs.org/en/latest/
     install splash first and install scrapyJS
     a. http://splash.readthedocs.org/en/latest/install.html
        yum -y remove docker
        yum install docker-io (docker 运行以来内核版本2.6.32-431 及以上,如centos 6.5以上,  命令 docker -d 输出信息 )
     b. pip install scrapyjs















你可能感兴趣的:(安装scrapy框架)