BeautifulSoup库的安装

来源:互联网 发布:apm性能监控 java 编辑:程序博客网 时间:2024/06/05 23:58

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

安装BeautifulSoup

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

解析器的安装

apt-get install Python-lxmleasy_install lxmlpip 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’)
原创粉丝点击