【已解决】lxml.etree.ParserError: Document is empty

本专栏解决日常生活工作中非快速找到解决方案的问题。

问题背景

在爬取某网站时,使用开源框架报错:lxml.etree.ParserError: Document is empty

解决方案

1、多个搜索引擎中查找,建议都是对lxml的python源码进行修改,不好用。(不推荐)

2、发现更好的解决方案:找到与python版本对应的 lxml 重新按照,是不兼容问题。(推荐)

例如,我的是python3.7, mac,使用 pip install lxml==4.6.5 重新安装即可。

相关推荐
IT空门:门主39 分钟前
Spring AI 2.1.0 更新了什么:从 2.0 升上来的完整梳理
人工智能·python·spring
AI创界者1 小时前
Python 进阶实战(七十章):遗留系统重构、渐进式绞杀与技术债治理实战
人工智能·python·aigc
ZhengEnCi2 小时前
电脑操作 Agent 一直点不中:截图没更新时,提示词该怎么改才能停止瞎试
人工智能·python·agent
Wellijohn4 小时前
dict、tuple、dataclass 还是 slots?我把 6 种数据载体的 8 项开销全测了一遍
后端·python·性能优化
bufengwangluo5 小时前
爬虫和调用 API 有什么区别?为什么优先选 API
python·网络爬虫·ip·api调用
Dmz丶5 小时前
前端转 AI 100 天 Day 54:RAG 项目实战(三)——多轮对话 + 会话管理
python
console.log('npc')5 小时前
Python第9课 类学习笔记,前端js语法对照
前端·python·学习
geovindu6 小时前
python:Logistic Regression
开发语言·后端·python·算法
geovindu8 小时前
python: Random Forest
开发语言·后端·python·算法·随机森林