python2.7 BeautifulSoup 模块 报错

2021-02-10 04:15

阅读:338

标签:error:   file   sub   ror   point   模块   object   pack   运行   

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

Traceback (most recent call last):
  File "xxx.py", line 10, in 
    from bs4 import BeautifulSoup
  File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 30, in 
    from .builder import builder_registry, ParserRejectedMarkup
  File "/Library/Python/2.7/site-packages/bs4/builder/__init__.py", line 4, in 
    from bs4.element import (
  File "/Library/Python/2.7/site-packages/bs4/element.py", line 5, in 
    from bs4.dammit import EntitySubstitution
  File "/Library/Python/2.7/site-packages/bs4/dammit.py", line 50, in 
    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

python2.7 BeautifulSoup 模块 报错

标签:error:   file   sub   ror   point   模块   object   pack   运行   

原文地址:https://www.cnblogs.com/rab3it/p/12744361.html


评论


亲,登录后才可以留言!