导入BeautifulSoup4时出错

时间:2015-04-08 19:27:14

标签: python beautifulsoup

我正在尝试导入BeautifulSoup4,但我遇到了输入问题。

我正在运行Python 2.7.9作为32位Windows(MSC v.1500)

我尝试将BeautifulSoup4安装为tarball并使用pip。两次尝试都安装了#34; bs4,但导入bs4产生:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\ArcGIS10.2\lib\site-packages\bs4\__init__.py", line 29, in <module>
    from .builder import builder_registry
  File "C:\Python27\ArcGIS10.2\lib\site-packages\bs4\builder\__init__.py", line 294, in <module>
    from . import _htmlparser
  File "C:\Python27\ArcGIS10.2\lib\site-packages\bs4\builder\_htmlparser.py", line 7, in <module>
    from HTMLParser import (
  File "C:\Python27\ArcGIS10.2\lib\HTMLParser.py", line 47, in <module>
    """, re.VERBOSE)
  File "C:\Python27\ArcGIS10.2\lib\re.py", line 190, in compile
    return _compile(pattern, flags)
  File "C:\Python27\ArcGIS10.2\lib\re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat

我不知道如何解决这个问题。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

尝试:

from bs4 import BeautifulSoup