2016-11-29 8 views
4

私は単にbeautifulsoup4-4.1.0をセットアップし、pipをバージョン9.0.1にアップグレードします。私はこれを書いたとき は:ImportError:名前 'HTMLAwareEntitySubstitution'をインポートできません

from bs4 import BeautifulSoup 

エラーが発生します?私は何をすべきか

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' 

感謝を。

+0

申し訳ありませんが、私はbeautifulsoupのバージョンabove.My私の説明は4.5.1で修正する必要があります。 –

+0

pipを使ってbs4をインストールしましたか? – jinksPadlock

+0

はい。実際にはpip8を使用してbs4をインストールしました。 –

答えて

11

might be an errorにはbs4/builder/__init__.pyが表示されています。

この行、from .. import _htmlparserは次のようになります。from . import _htmlparser

しかし、私はあなたが殴らパスをオフに行くと、ソースコードを編集しようとする前にpipの現在のバージョンを使用してパッケージを再インストールすることをお勧め。再インストールするには

pip install --upgrade --force-reinstall beautifulsoup4

関連する問題