听说lxml这个库相当赞,从网上看到最快的安装方式是先装easy_install
访问http://pypi.python.org/pypi/setuptools#files下载合适的版本
安装完后,easy_install的脚本安放在C:\Python26\Lib\site-packages下
然后将 C:\Python26\Scripts
设置在windows的path目录下
安装lxml
http://codespeak.net/lxml/installation.html
在cmd运行easy_install lxml命令后,就可以使用lxml库了
C:\Documents and Settings\>easy_install lxml
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3beta1
Downloading http://pypi.python.org/packages/2.6/l/lxml/lxml-2.3beta1-py2.6-win3
.egg#md5=d4dafc94ae9543661e4c5722496d923d
Processing lxml-2.3beta1-py2.6-win32.egg
creating c:\python26\lib\site-packages\lxml-2.3beta1-py2.6-win32.egg
Extracting lxml-2.3beta1-py2.6-win32.egg to c:\python26\lib\site-packages
Adding lxml 2.3beta1 to easy-install.pth file
Installed c:\python26\lib\site-packages\lxml-2.3beta1-py2.6-win32.egg
Processing dependencies for lxml
Finished processing dependencies for lxml
在按写soupparser例子的时候,报
ImportError: No module named BeautifulSoup
的错,主要还是没安装 BeautifulSoup 这个module
去http://www.crummy.com/software/BeautifulSoup/ 下载推荐的3.2.0版本
然后按module文档进行安装
D:\python\BeautifulSoup-3.2.0>python setup.py install
running install
running build
running build_py
creating build
creating build\lib
copying BeautifulSoup.py -> build\lib
copying BeautifulSoupTests.py -> build\lib
running install_lib
copying build\lib\BeautifulSoup.py -> c:\python26\Lib\site-packages
copying build\lib\BeautifulSoupTests.py -> c:\python26\Lib\site-packages
byte-compiling c:\python26\Lib\site-packages\BeautifulSoup.py to BeautifulSoup.p
yc
byte-compiling c:\python26\Lib\site-packages\BeautifulSoupTests.py to BeautifulS
oupTests.pyc
running install_egg_info
Writing c:\python26\Lib\site-packages\BeautifulSoup-3.2.0-py2.6.egg-info