我试图运行一个简单的脚本并从网页中提取一些值。但是,我收到错误'无法导入lxml'。这是完整的脚本
from lxml import html
page = requests.get('http://awebpage.com')
tree = html.fromstring(page.content)
names = tree.xpath('someXPath')
print names
我做了pip install lxml,它说,
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/lib/python2.7/dist-packages
Cleaning up...
编辑:我也做了pip冻结,就像另一张检查一样,以确保它已安装。