运行爬虫遇到奇葩的问题 bs4.FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.

Posted 闭关苦炼内功

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了运行爬虫遇到奇葩的问题 bs4.FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.相关的知识,希望对你有一定的参考价值。

运行python爬虫遇到奇葩的问题


F:\\bs\\bosszp>python bosszp.py
https://www.zhipin.com/c101190100/?query=ETL工程师&page=1&ka=page-1
Traceback (most recent call last):
  File "bosszp.py", line 167, in <module>
    get_job(url=url, conn=conn, cursor=cursor, city_name_x="北京")
  File "bosszp.py", line 117, in get_job
    soup = BeautifulSoup(html, 'lxml')
  File "D:\\software\\DevEnv\\Python\\lib\\site-packages\\bs4\\__init__.py", line 246, 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?
F:\\bs\\bosszp>pip install parser
ERROR: Could not find a version that satisfies the requirement parser (from versions: none)
ERROR: No matching distribution found for parser

F:\\bs\\bosszp>

解决方案(无效)

F:\\bs\\bosszp>pip install html_parser
Collecting html_parser
  Downloading html-parser-0.2.tar.gz (904 bytes)
Collecting ply
  Downloading ply-3.11-py2.py3-none-any.whl (49 kB)
     |████████████████████████████████| 49 kB 163 kB/s
Using legacy 'setup.py install' for html-parser, since package 'wheel' is not installed.
Installing collected packages: ply, html-parser
    Running setup.py install for html-parser ... done
Successfully installed html-parser-0.2 ply-3.11

F:\\bs\\bosszp>

然后发现不行


最终解决方案

pip install lxml

然后

soup = BeautifulSoup(html, 'lxml')

以上是关于运行爬虫遇到奇葩的问题 bs4.FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.的主要内容,如果未能解决你的问题,请参考以下文章

Maven项目中遇到的奇葩问题(续)

Maven项目中遇到的奇葩问题(续)

Spring Boot奇葩问题总结

学习JavaEE过程中遇到的各种(奇葩)问题

奇葩的Sketch教程

java发送邮件,遇到的奇葩问题