码迷,mamicode.com
首页 > 编程语言 > 详细

python2.7 BeautifulSoup 模块 报错

时间:2020-04-21 15:26:48      阅读:64      评论:0      收藏:0      [点我收藏+]

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

运行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

python2.7 BeautifulSoup 模块 报错

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

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!