...
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,并按照本教程操作获得了Beautiful Soup和lxml,它们都已成功安装并与位于此处的单独测试文件一起使用。在导致此错误的Python脚本中,我包含以下行:
from pageCrawler import comparePages
在pageCrawler文件中,我包含以下两行:
from bs4 import BeautifulSoup
from urllib2 import urlopen
找出问题所在以及如何解决的任何帮助将不胜感激。
html
url还是html内容?