#pip安裝lxml解析方法
pip3 install lxml
#或者通過wheel安裝
#下載對應系統版本的wheel文件:http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
pip3 install lxml-4...whl
#pip安裝beautifulsoup4庫
pip3 install beautifulsoup4
# 從bs4導入BeautifulSoup庫
from bs4 import BeautifulSoup
# 生成soup對象,傳入html代碼和解析方法lxml
soup = BeautifulSoup('<html></html>','lxml')