zoukankan      html  css  js  c++  java
  • python bs4解析网页时 bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to inst(转)

    Python小白,学习时候用到bs4解析网站,报错

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

    几经周折才知道是bs4调用了python自带的html解析器,我用的mac,默认安装的是python2,所以内置的解释器也是捆绑在python2上,而我学习的时候又自己安装了python3,开发环境也是python3的,貌似是没有html解释器,所以会报错。
    问题找到了,那么怎么解决呢?对,在python3也装一个html解析器就好了,那么怎么安装呢?查阅资料获悉:一般pip和pip2对应的是python2.x,pip3对应的是python3.x的版本,python2和python3的模块是独立的,不能混用,混用会出问题。所以命令行通过python3的pip:pip3 安装解析器:

    $ pip3 install lxml

    3.8M,稍等片刻即可
    再次运行项目,完美解决,特此记录

  • 相关阅读:
    webpack打包报错configuration has an unknown property 'mode'
    CSP 201712-4 行车路线(最短路)
    设计模式
    sqlserver 迁移数据
    DataX
    Python 对接WebService
    IOS APP打包流程
    nginxUI
    ROS脚本-下线时判断在线数量进行重拨号
    bash 字符串截取的8种方法
  • 原文地址:https://www.cnblogs.com/blogpro/p/11343832.html
Copyright © 2011-2022 走看看