• (转)Scrapy安装介绍 windows环境下---


    一、 Scrapy简介

    Scrapy is a fast high-level screen scraping and web crawling framework, used to crawl websites and extract structured data from their pages. It can be used for a wide range of purposes, from data mining to monitoring and automated testing.

    官方主页: http://www.scrapy.org/

    二、 安装Python2.7

    官方主页:http://www.python.org/

    下载地址:http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi

    1) 安装python

    安装目录:D:Python27

    2) 添加环境变量

    略System Properties -> Advanced -> Environment Variables - >System Variables -> Path -> Edit

    3) 验证环境变量

    T:>set Path
    Path=C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;D:Rationalcommon;D:RationalClearCasein;D:Python27;D:Python27Scripts
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

    4) 验证Python

    复制代码
    T:>python
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    
    T:>
    复制代码

    三、 安装Twisted

    Twisted is an event-driven networking engine written in Python and licensed under the open source

    1) 安装setuptools

    Download, build, install, upgrade, and uninstall Python packages -- easily!

    官方主页:http://pypi.python.org/pypi/setuptools

    下载地址:http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe

    安装过程:略

    2) 安装Zope.Interface

    官方主页:http://pypi.python.org/pypi/zope.interface/

    下载地址:http://pypi.python.org/packages/2.7/z/zope.interface/zope.interface-4.0.1-py2.7-win32.egg

    安装过程:

    复制代码
    T:>d:
    D:>cd D:Python27Scripts
    D:Python27Scripts>easy_install.exe zope.interface-4.0.1-py2.7-win32.egg
    Processing zope.interface-4.0.1-py2.7-win32.egg
    creating d:python27libsite-packageszope.interface-4.0.1-py2.7-win32.egg
    Extracting zope.interface-4.0.1-py2.7-win32.egg to d:python27libsite-packages
    Adding zope.interface 4.0.1 to easy-install.pth file
    
    Installed d:python27libsite-packageszope.interface-4.0.1-py2.7-win32.egg
    Processing dependencies for zope.interface==4.0.1
    Finished processing dependencies for zope.interface==4.0.1
    
    D:Python27Scripts>
    复制代码

    验证安装:

    D:Python27Scripts>python
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import zope.interface
    >>>

    3) 安装Twisted

    官方主页:http://twistedmatrix.com/trac/wiki/TwistedProject

    下载地址:http://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.1.0.win32-py2.7.msi

    安装过程:略

    四、 安装w3lib

    官方主页:http://pypi.python.org/pypi/w3lib

    下载地址: http://pypi.python.org/packages/source/w/w3lib/w3lib-1.2.tar.gz

    解压过程:略

    安装过程:

    复制代码
    T:w3lib-1.2>python setup.py install
    running install
    running build
    running build_py
    creating build
    creating buildlib
    creating buildlibw3lib
    copying w3libencoding.py -> buildlibw3lib
    copying w3libform.py -> buildlibw3lib
    copying w3libhtml.py -> buildlibw3lib
    copying w3libhttp.py -> buildlibw3lib
    copying w3liburl.py -> buildlibw3lib
    copying w3libutil.py -> buildlibw3lib
    copying w3lib\__init__.py -> buildlibw3lib
    running install_lib
    creating D:Python27Libsite-packagesw3lib
    copying buildlibw3libencoding.py -> D:Python27Libsite-packagesw3lib
    copying buildlibw3libform.py -> D:Python27Libsite-packagesw3lib
    copying buildlibw3libhtml.py -> D:Python27Libsite-packagesw3lib
    copying buildlibw3libhttp.py -> D:Python27Libsite-packagesw3lib
    copying buildlibw3liburl.py -> D:Python27Libsite-packagesw3lib
    copying buildlibw3libutil.py -> D:Python27Libsite-packagesw3lib
    copying buildlibw3lib\__init__.py -> D:Python27Libsite-packagesw3lib
    byte-compiling D:Python27Libsite-packagesw3libencoding.py to encoding.pyc
    byte-compiling D:Python27Libsite-packagesw3libform.py to form.pyc
    byte-compiling D:Python27Libsite-packagesw3libhtml.py to html.pyc
    byte-compiling D:Python27Libsite-packagesw3libhttp.py to http.pyc
    byte-compiling D:Python27Libsite-packagesw3liburl.py to url.pyc
    byte-compiling D:Python27Libsite-packagesw3libutil.py to util.pyc
    byte-compiling D:Python27Libsite-packagesw3lib\__init__.py to __init__.pyc
    running install_egg_info
    Writing D:Python27Libsite-packagesw3lib-1.2-py2.7.egg-info
    
    T:w3lib-1.2>
    复制代码

    验证安装:

    T:>python
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import w3lib
    >>> 

    五、 安装libxml2

    官方主页:http://users.skynet.be/sbi/libxml-python/http://pypi.python.org/pypi/pyOpenSSL

    下载地址:http://users.skynet.be/sbi/libxml-python/binaries/libxml2-python-2.7.7.win32-py2.7.exe

    安装过程:略

    验证安装:

    T:>python
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import libxml2
    >>> 

    六、 安装pyOpenSSL

    官方主页:http://pypi.python.org/pypi/pyOpenSSL

    下载地址:http://pypi.python.org/packages/2.7/p/pyOpenSSL/pyOpenSSL-0.13.winxp32-py2.7.msi

    安装过程:略

    验证安装:

    T:>python
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import OpenSSL
    >>>

    七、 安装Scrapy

    官方主页:http://scrapy.org/

    下载地址:http://pypi.python.org/packages/source/S/Scrapy/Scrapy-0.14.4.tar.gz

    解压过程:略

    安装过程:

    复制代码
    T:Scrapy-0.14.4>python setup.py install
    
    ……
    Installing easy_install-2.7-script.py script to D:Python27Scripts
    Installing easy_install-2.7.exe script to D:Python27Scripts
    Installing easy_install-2.7.exe.manifest script to D:Python27Scripts
    
    Using d:python27libsite-packages
    Finished processing dependencies for Scrapy==0.14.4
    
    T:Scrapy-0.14.4>
    复制代码

    加变量到path 即 "D:Python27Scripts"

    验证安装:

    复制代码
    T:>scrapy
    Scrapy 0.14.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
    
    Use "scrapy <command> -h" to see more info about a command
    
    T:>

  • 相关阅读:
    struts token令牌机制
    javascript的splice()方法备注
    [转的哦】 Android字符串资源及其格式化Android 中的string.xml用法小结
    3.Android I/O文件写入和读取
    Android开发_读取联系人信息_读取通讯录号码
    ListView的美化涉及到的一些属性
    4.Android添加背景音乐的方法
    Android 网络协议
    ContentValues 和HashTable之间的区别
    5.Andorid绘图方法(Canvas)
  • 原文地址:https://www.cnblogs.com/wuxinqiu/p/3853530.html
Copyright © 2020-2023  润新知