【发布时间】:2017-02-28 05:25:52
【问题描述】:
...
soup = BeautifulSoup(html, "lxml")
File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 152, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
我的终端上的上述输出。我在 Mac OS 10.7.x 上。我有 Python 2.7.1,并按照 this tutorial 获得 Beautiful Soup 和 lxml,它们都成功安装并使用单独的测试文件 located here。在导致此错误的 Python 脚本中,我包含了这一行:
from pageCrawler import comparePages
在 pageCrawler 文件中,我包含了以下两行:
from bs4 import BeautifulSoup
from urllib2 import urlopen
任何帮助找出问题是什么以及如何解决问题将不胜感激。
【问题讨论】:
-
html是 url 还是 html 内容?
标签: python python-2.7 beautifulsoup lxml