I just setup beautifulsoup4-4.1.0 and upgrade pip to version 9.0.1. When I write this :
from bs4 import BeautifulSoup
error occurs:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
from bs4 import BeautifulSoup
File "D:\Program Files (x86)\Python35-32\lib\site-packages\bs4\__init__.py", line 35, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "D:\Program Files (x86)\Python35-32\lib\site-packages\bs4\builder\__init__.py", line 7, in <module>
from bs4.element import (
ImportError: cannot import name 'HTMLAwareEntitySubstitution'
what should I do?Many thanks.
In the version you have it appears that there might be an error in
bs4/builder/__init__.py
.This line,
from .. import _htmlparser
should be:from . import _htmlparser
However, I would suggest re-installing the package using current version of
pip
before you go off the beaten path and try editing the source code.To re-install:
pip install --upgrade --force-reinstall beautifulsoup4