etree.html 报错

1.Pycharm 中lxml没有etree模块的解决方法:

之前是:

from lxml import etree

tree = etree.HTML( )

python 3.5以上版本lxml中没有了etree, 要换另外一种方式引入:

from lxml import html

etree = html.etree()

2.报错:AttributeError:‘function’ object has no attribut ‘HTML’

以上换了还是解决不了,一直报错AttributeError:‘function’ object has no attribut 'HTML’或AttributeError:‘function’ object has no attribut ‘Xpath’,那问题可能就大一点了,我也是弄了一天没解决,看了网上的可以,然后直接就是不行,最后的最后解决了,办法就是:新建一个项目,然后把代码全部搬到新建的项目,然后突然发现etree.html没有报错了,可以运行了,原因我也不知道,就很神奇,弄了一天,问了好多人,百度了好多,还是不行,结果搬到另一个项目去就可以了。如果你是这样,就尝试新建一个项目试试,或许可以。

etree.html 报错 AttributeError:‘function’ object has no attribut ‘HTML’相关推荐

  1. Scrapy爬虫报错AttributeError: ‘NoneType‘ object has no attribute ‘write‘

    前言 一.报错 AttributeError: 'NoneType' object has no attribute 'write' 二.报错原因 1.piplines文件中的方法不能自定义的呢 开始 ...

  2. 关于在《python编程从入门到实践》书中练习“外星人大战”报错“AttributeError: ‘AlienInvasion‘ object has no attribute ‘blit‘”

    关于在<python编程从入门到实践>书中练习"外星人大战"报错"AttributeError: 'AlienInvasion' object has no ...

  3. 爬虫的自创建请求对象:报错AttributeError: 'str' object has no attribute 'items'

    在使用爬虫库创建自定义请求对象时 将值传入headers agent = random.choice(userAgent) REQ = request.Request(url,headers=agen ...

  4. 运行项目时flask_sqlalchemy报错AttributeError: ‘LocalStack‘ object has no attribute ‘__ident_func__‘

    运行项目时flask_sqlalchemy报错AttributeError: 'LocalStack' object has no attribute '__ident_func__' 1.原因 2. ...

  5. python 报错 AttributeError: type object ‘datetime.datetime‘ has no attribute ‘datetime‘

    python报错:type object 'datetime.datetime' has no attribute 'datetime' 描述:在第一个python程序里还未报错,第二个程序完全复制过 ...

  6. python3 多进程 multiprocessing 报错 AttributeError: ‘ForkAwareLocal‘ object has no attribute ‘connection‘

    目录 错误代码 报错信息 错误原因 解决方法 错误代码 python多进程管理manager时候,当不使用join对当前进程(主进程)进行阻塞时会报错,具体代码及错误如下: from multipro ...

  7. unittest-ddt报错AttributeError: type object ‘forTestDDT‘ has no attribute ‘test_2‘

    unittest 添加多个ddt数据驱动后,报错: FAILED (errors=1)Error Traceback (most recent call last):File "D:\Ana ...

  8. 报错AttributeError: ‘NoneType‘ object has no attribute ‘shape‘

    环境: python3.6.4 opencv3.4.1.15 运行目标跟踪object_tracking文件夹中的mean函数时报错且不显示视频结果 Traceback (most recent ca ...

  9. python的mysql数据查询及报错AttributeError: 'Connection' object has no attribute 'curson'

    import pymysql #创建连接 con = pymysql.connect(host='localhost',user='root',password='123456',port=3306, ...

最新文章

  1. Java 访问RabbitMQ
  2. 【EventBus】EventBus 事件总线框架简介 ( EventBus 使用流程 )
  3. [拓扑排序/强联通分量] [NOIP201402] 信息传递
  4. Algorithm:C++语言实现之SimHash和倒排索引算法相关(抽屉原理、倒排索、建立查找树、处理Hash冲突、Hash查找)
  5. Nginx模块开发中使用PCRE正则表达式匹配
  6. .Net中的AOP系列之《方法执行前后——边界切面》
  7. 静态 非静态代码块和构造器的执行顺序测试方法
  8. 【面试必备】java面试题视频讲解
  9. HTML5拖拽API的使用实例
  10. 与基础事务管理器的通信失败 存货申请_干货必读!细说分布式事务两阶段提交...
  11. 第一百七十三节,jQuery,Ajax
  12. PaddleOCR 文本检测训练+推理模型转换教程
  13. C++ 修改 Windows Service【转】
  14. Excel常用功能总结
  15. linux上mysql命令无效_linux下mysql命令没用
  16. [洛谷] P3174 [HAOI2009]毛毛虫 (树形dp 树的最长直径的扩展)
  17. 人工智能在肿瘤成像中的临床挑战和应用
  18. 服务器系统2008恢复,win2003升级为win2008、win2012保留数据重装恢复数据说明
  19. 姓杨取名:杨姓女孩文雅有寓意的名字,真的是万里挑一
  20. prompt learning——你需要掌握的基础知识以及离散型 prompt 的代码

热门文章

  1. 刘谦读心术解密---JavaScript实现
  2. 半年总结——欲戴王冠,必承其重
  3. java实现抽签抓阄(附完整源码)
  4. 职场小故事分享(4)
  5. 开县计算机网络培训学校,重庆开州区职业教育中心
  6. 布伦特原油 和 美原油双原油对冲套利程序化策略解析
  7. 移动开发者大会次日观感
  8. 在线教育平台开发的影响和意义
  9. 小黄车使用场景——测试用例
  10. 第1篇:window入侵排查