Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?----最终解

我在使用BeautifulSoup的时候对于html的解析器选择了lxml

soup = BeautifulSoup(r.text, "lxml")

然后就报错了,Baidu和Google后都没有找到太满意的答案,他们的做法有的是将解析器更改成原生的Python解析器,还有的就是一些对我没有太大帮组的回答

我尝试导入lxml后发现没有问题,但是对于etree模块却显示无法找到,所以大致猜测是版本的问题,于是去网上找了对应版本的lxml进行下载。

下载网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

安装方式:https://blog.csdn.net/zgscwxd/article/details/83515804?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

猜你喜欢

转载自www.cnblogs.com/lcs-1503647333/p/13162328.html