python中的bs4怎么导入_在Python 3.5导入BS4
I have installed both Python 3.5 and Beautifulsoup4. When I try to import bs4, I get the error below. Is there any fix for that? Or should I just install Python 3.4 instead?
Please be very explicit - I am new to programming. Many thanks!
Traceback (most recent call last):
File "", line 1, in
File "C:\Python 3.5\lib\sit-packages\bs4\__init__.py", line 30, in
from .builder import builder_registry, ParserRejectionMarkup
File "C:\Python 3.5\lib\sit-packages\bs4\__init__.py", line 308, in
from . import _htmlparser
File "C:\Python 3.5\lib\sit-packages\bs4\_htmlparser.py", line 7, in
from html.parser import (
ImportError: cannot import name 'HTMLParseError'
解決方案
Update: Starting with 4.4.0, BeautifulSoup is compatible with Python 3.5. Upgrade:
pip install --upgrade beautifulsoup4
Old answer:
Because of the changes made for Deprecate strict mode of HTMLParser issue:
Issue #15114: the strict mode and argument of HTMLParser,
HTMLParser.error, and the HTMLParserError exception have been removed.
I'm afraid beautifulSoup4 is not compatible with Python 3.5 at the moment. Use Python 3.4.
總結
以上是生活随笔為你收集整理的python中的bs4怎么导入_在Python 3.5导入BS4的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python关闭exe程序_Win 10
- 下一篇: 量子计算机 真假,复原乳到底有没有营养?