lxml: Cannot import lxml.html.soupparser.fromstring, depends on outdated BeautifulSoup
来源:互联网 发布:中国股市现状 知乎 编辑:程序博客网 时间:2024/06/05 23:41
refer to: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=801476
When trying to perform the following with Python 3: from lxml.html.soupparser import fromstringThe following error is raised: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3/dist-packages/lxml/html/soupparser.py", line 7, in <module> from BeautifulSoup import \ ImportError: No module named 'BeautifulSoup'According to StackOverflow <http://stackoverflow.com/q/14042023>, this isbecause the currently packaged version of python3-lxml depends on version 3 ofBeautifulSoup. However, Debian ships version 4 of that module (python3-bs4).According to the same source, recent lxml versions know how to use version 4 ofBeautifulSoup, see e.g.,<https://github.com/lxml/lxml/blob/master/src/lxml/html/soupparser.py>.
解决办法:
import sys, bs4sys.modules['BeautifulSoup'] = bs4from lxml.html.soupparser import fromstring
0 0
- lxml: Cannot import lxml.html.soupparser.fromstring, depends on outdated BeautifulSoup
- lxml
- 安装lxml HTML 解析器,需要c语言库? BeautifulSoup
- BeautifulSoup及lxml使用小记
- 用lxml解析HTML
- Python+lxml解析html
- 用lxml解析HTML
- python3.3 lxml+beautifulsoup 爬虫说明
- Scraper——BeautifulSoup and LXML
- BeautifulSoup和lxml的基本用法示例
- 如何从word开始处理html文件?以及windows上安装python lxml beautifulsoup
- Python:用lxml解析HTML
- 【简记】用lxml解析html
- 使用lxml解析HTML数据
- no module named lxml.html`
- mac中安装python, pydev, beautifulsoup, lxml, scrapy
- mac中安装python, pydev, beautifulsoup, lxml, scrapy
- BeautifulSoup提示找不到lxml解析包的解决方法
- spring--mybatis--activeMQ集成(一)
- Android studio如何使用SVN进行版本控制
- 第八课 IDEA开发spark
- python 核心编程&对象
- ProgressDialog使用总结
- lxml: Cannot import lxml.html.soupparser.fromstring, depends on outdated BeautifulSoup
- 【数据结构】算法10.4-10.5 插入排序-希尔
- git使用方法
- hdu5000 Clone dp
- Java线程之线程的五种状态
- lightoj 1021 从当前转移到其他状态的状压dp
- Java基础——实现UDP发送数据和接收数据
- 数据库实战(四)数据库主从复制
- R语言内存管理