這幾天正好有需求實現一個爬蟲程序,想到爬蟲程序立馬就想到了python,python相關的爬蟲資料好像也特別多。因而就決定用python來實現爬蟲程序了,正好發現了python有一個開源庫scrapy,正是用來實現爬蟲框架的,因而果斷採用這個實現。下面就先安裝scrapy,決定在windows下面安裝。css
Scrapy是一個快速,高效的網頁抓取python框架。主要用於Web抓取&提取信息&格式化數據。常常用此作數據挖掘、檢測、測試等。html
C:\Users\admin>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>>
C:\Users\admin>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import zope.interface >>>
#進入插件目錄並執行命令安裝
>D:\python-plugin\w3lib-1.3>python setup.py install
驗證java
D:\python-plugin\w3lib-1.3>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import w3lib >>>
這是由於pyOpenSSL編譯須要藉助VC++編譯,因此若是這個時候已經安裝了visual studio,就須要執行visual studio的路徑:python
若是安裝了 Visual Studio 2010,則執行以下命令:web
SET VS90COMNTOOLS=%VS100COMNTOOLS%sql
若是安裝了 Visual Studio 2012 (Visual Studio Version 11),則執行以下命令:shell
SET VS90COMNTOOLS=%VS110COMNTOOLS%windows
若是安裝了 Visual Studio 2013 (Visual Studio Version 12),那麼執行下面命令api
SET VS90COMNTOOLS=%VS120COMNTOOLS%bash
能夠參考文章:http://blog.csdn.net/secretx/article/details/17472107
> set LIB=C:\OpenSSL-Win32\lib\VC\static;%LIB%
> set INCLUDE=C:\OpenSSL-Win32\include;%INCLUDE%
則這個時候編譯經過
#進入scrapy目錄並執行安裝
>D:\python-plugin\Scrapy-0.16.5>python setup.py install
驗證
D:\python-plugin\Scrapy-0.16.5>scrapy
Scrapy 0.16.5 - 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 D:\python-plugin\Scrapy-0.16.5>
安裝完畢 OK