0
我是python開發新手,最近在我的Windows 8機器上安裝了一個全新的64位版本的anaconda(使用python v。2.7.12)昨天(https://www.continuum.io/downloads#windows)。我立即發佈了帶有anaconda的Jupyter Notebook實例,並期望能夠使用BeautifulSoup。當我notebook.ipynb文件執行這一行:from bs4 import BeautifulSoup
我收到ImportError
:Jupyter Notebook BeautifulSoup ImportError
ImportError Traceback (most recent call last)
<ipython-input-12-cbb98e44f096> in <module>()
9 #from yelp.oauth1_authenticator import Oauth1Authenticator
10
---> 11 from bs4 import BeautifulSoup
C:\Users\xxx\Anaconda2\lib\site-packages\bs4\__init__.py in <module>()
33 import warnings
34
---> 35 from .builder import builder_registry, ParserRejectedMarkup
36 from .dammit import UnicodeDammit
37 from .element import (
C:\Users\xxx\Anaconda2\lib\site-packages\bs4\builder\__init__.py in <module>()
313 # to take precedence over html5lib, because it's faster. And we only
314 # want to use HTMLParser as a last result.
--> 315 from . import _htmlparser
316 register_treebuilders_from(_htmlparser)
317 try:
C:\Users\xxx\Anaconda2\lib\site-packages\bs4\builder\_htmlparser.py in <module>()
8 ]
9
---> 10 from HTMLParser import HTMLParser
11
12 try:
ImportError: cannot import name HTMLParser
我已經試過:
- PIP安裝的HTMLParser
- PIP安裝BS4
- 卸載和在anaconda導航器中安裝beautifulsoup4和beautifulsoup軟件包。
- 暢達安裝的HTMLParser - >導致包裝內的蟒蛇回購錯誤未找到
- 暢達安裝BS4 - >導致包裝內的蟒蛇回購錯誤未找到
我一直試圖讓這個集無需在筆記本電腦上使用虛擬環境。我認爲它有可能使它與root env一起工作。
任何有關這個問題的幫助將不勝感激!
這很奇怪... ['HTMLParser'](// docs.python.org/2/library/htmlparser.html)應該在Python 2.2+的標準庫中,並且只能在Python 3中重命名爲'html.parser'。 –
注意:在安裝anaconda之前,我已經卸載了所有版本的python(2.7.12和3.5)。 – miniscem