码迷,mamicode.com
首页 > 其他好文 > 详细

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

时间:2018-03-01 23:39:01      阅读:717      评论:0      收藏:0      [点我收藏+]

标签:log   mod   parser   lan   traceback   https   join   ges   oca   

环境是win10 python3.5

安装beautifulsoup后,运行测试报错

from bs4 import BeautifulSoup
soup = BeautifulSoup(<p>Hello</p>, lxml)
print(soup.p.string)
Traceback (most recent call last):
  File "C:\Users\Lenovo\Desktop\Spider_1.py", line 6, in <module>
    soup = BeautifulSoup(req.content,"lxml")
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python35\lib\site-packages\bs4\__init__.py", line 165, in __init__
    % ",".join(features))
bs4.FeatureNotFound: Couldnt find a tree builder with the features you requested: lxml. Do you need to install a parser library?

经过测试发现是lxml的问题,使用 pip install lxml时,自动安装的 4.1.1版本,

下载lxml 3.7.3  安装后,问题解决 

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

标签:log   mod   parser   lan   traceback   https   join   ges   oca   

原文地址:https://www.cnblogs.com/zrdm/p/8490767.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!