安装lxml,抓取、解析网页

准备工作:

 

1.确认python-dev,cython(可不安装),easy_install都已安装好(安装方法见:http://blog.csdn.net/qazplm12_3/archive/2010/08/17/5818471.aspx )。

 

2.安装

  • libxml 2.6.21 or later. It can be found here: http://xmlsoft.org/downloads.html

    If you want to use XPath, do not use libxml2 2.6.27. We recommend libxml2 2.7.3, 2.7.7 or later.

  • libxslt 1.1.15 or later. It can be found here: http://xmlsoft.org/XSLT/downloads.html

 3.安装lxml

 

操作如下:

 

#!/bin/bash

 

 

sudo apt-get install libxml2-dev

sudo apt-get install libxslt1-dev

 

easy_install lxml

 

 

参考:http://codespeak.net/lxml/installation.html

你可能感兴趣的:(工作,2010)