Python3.7 安装 Beautifulsoup4 出现错误 ImportError: cannot import

“安装的bs为4.4.1以下的则import bs4的时候会出现「ImportError: cannot import name 'HTMLParseError' from 'html.parser'」

解决方法:

1.卸载已安装好的bs4,可以使用pip/pip3卸载(若同时存在Python2 和 Python3 ,需要同时卸载)

pip3 uninstall beautifulsoup4

如果pip卸载的方式不行,可以通过手动删除的方式:

pip3 show beautifulsoup4 

通过此命令查看bs4地址,然后直接rm删除

2.再次通过pip3进行安装

pip3 install beautifsoup4


分享至
2019-10-11 发布 ┊ 1357 人浏览 ┊ 0 人评论 ┊ 来源:原创 ┊ 收藏
返回顶部