Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 不能';我找不到一个具有您要求的特性的树生成器:html5lib。您需要安装解析器库吗?_Python_Beautifulsoup - Fatal编程技术网

Python 不能';我找不到一个具有您要求的特性的树生成器:html5lib。您需要安装解析器库吗?

Python 不能';我找不到一个具有您要求的特性的树生成器:html5lib。您需要安装解析器库吗?,python,beautifulsoup,Python,Beautifulsoup,我尝试将soup4与我的python3.5结合使用,但当我从互联网上提取代码时,我会遇到以下错误: - s4\__init__.py", line 198, in __init__ % ",".join(features)) bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser l

我尝试将soup4与我的python3.5结合使用,但当我从互联网上提取代码时,我会遇到以下错误:

 - s4\__init__.py", line 198, in __init__
       % ",".join(features)) bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to    install a parser library?
此站点中存在具有相同错误的链接 我尝试了所有的方法,但仍然得到了错误

所有pip安装请求 pip安装lxml pip安装程序4

我下载了soup4手册和install it setup.py安装


我已经完成了所有更新和工作,但是如果您使用
html5lib
作为底层解析器,我仍然会收到错误plz help me

soup = BeautifulSoup(html, "html5lib")
#                            ^HERE^
然后,您需要在python环境中安装
html5lib
模块:

pip install html5lib

文档参考:。

对于那些即使安装了html5lib也会出现相同错误的用户,请按照中的建议将“html5lib”替换为“html.parser”


为我工作:)

为我工作html.parser

from bs4 import BeautifulSoup
import urllib.request 
response = urllib.request.urlopen('http://php.net/') 
html = response.read()
soup = BeautifulSoup(html,"html.parser")
text = soup.get_text(strip=True)
print (text)

使用“html.parser”而不是“html5lib”。这将起作用。

您的代码是什么导致了此错误?