简体   繁体   English

导入BeautifulSoup4时出错

[英]Errors importing BeautifulSoup4

I am trying to import BeautifulSoup4, but am running into importation issues. 我正在尝试导入BeautifulSoup4,但是遇到导入问题。

I am running Python 2.7.9 as 32 bit Windows (MSC v.1500) 我将Python 2.7.9作为32位Windows(MSC v.1500)运行

I attempted to install BeautifulSoup4 as both a tarball and using pip. 我试图同时将BeautifulSoup4安装为tarball和pip。 Both attempts have "installed" bs4, but import bs4 yields: 两次尝试都“安装”了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

I have no idea how to fix this. 我不知道该如何解决。 Any help would be appreciated. 任何帮助,将不胜感激。

尝试:

from bs4 import BeautifulSoup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM