python2.7 BeautifulSoup 模块 报错

运行python文件,发现 BeautifulSoup 模块 报错

Traceback (most recent call last):
  File "xxx.py", line 10, in <module>
    from bs4 import BeautifulSoup
  File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 30, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "/Library/Python/2.7/site-packages/bs4/builder/__init__.py", line 4, in <module>
    from bs4.element import (
  File "/Library/Python/2.7/site-packages/bs4/element.py", line 5, in <module>
    from bs4.dammit import EntitySubstitution
  File "/Library/Python/2.7/site-packages/bs4/dammit.py", line 50, in <module>
    class EntitySubstitution(object):
  File "/Library/Python/2.7/site-packages/bs4/dammit.py", line 71, in EntitySubstitution
    CHARACTER_TO_HTML_ENTITY_RE) = _populate_class_variables()
  File "/Library/Python/2.7/site-packages/bs4/dammit.py", line 59, in _populate_class_variables
    character = chr(codepoint)
ValueError: chr() arg not in range(256)

更新 beautifulsoup4 模块

pip install --upgrade beautifulsoup4

没有这个模块需要重新安装

pip install bs4
posted @ 2020-04-21 14:21  rab3it  阅读(316)  评论(0)    收藏  举报