BeautifulSoup库的安装

BeautifulSoup3已经停止开发,已经迁移至BeautifulSoup 4。BeautifulSoup 4 同时兼容Python2和Python3。

安装BeautifulSoup

  • Debain/Ubuntu
apt-get install Python-bs4
  • PyPi
easy_install beautifulsoup4
pip install beautifulsoup4
  • 源码安装
    下载bs4源码
python setup.py install

解析器的安装

apt-get install Python-lxml
easy_install lxml
pip install lxml
解析器 使用方法
Python标准库 BeautifulSoup(markup, ‘html.parser’)
lxml HTML解析器 BeautifulSoup(markup, ‘lxml’)
lxml XML解析器 BeautifulSoup(markup, [‘lxml’, ‘xml’])
BeautifulSoup(markup, ‘xml’)
html5lib BeautifulSoup(markup, ‘html5lib’)

你可能感兴趣的:(Python爬虫,爬虫,python,库)