当我不使用美丽汤时,如何摆脱美丽汤html解析器错误



我将用GUI制作一个字典程序,但我在第一个障碍上摔倒了。我刚刚安装了一个模块(PyDictionary(,但是当我运行以下代码时,我收到错误。

from PyDictionary import PyDictionary
dictionary = PyDictionary()
print(dictionary.meaning("fish"))

哪个返回

The code that caused this warning is on line 3 of the file Dictionary.py. To 
get rid of this warning, change code that looks like this:
 BeautifulSoup(YOUR_MARKUP})
to this:
 BeautifulSoup(YOUR_MARKUP, "lxml")
  markup_type=markup_type))
{'Noun': ['any of various mostly cold-blooded aquatic vertebrates usually having scales and breathing through gills', 'the flesh of fish used as food', '(astrology', 'the twelfth sign of the zodiac; the sun is in this sign from about February 19 to March 20'], 'Verb': ['seek indirectly', 'catch or try to catch fish or shellfish']}

看起来这是PyDictionary的问题,如此处所述。它抛出BeautifulSoup错误的原因是PyDictionary是使用BeautifulSoup实现的。

但是,看起来问题可能已解决。你用pip安装了PyDictionary吗?如果是这样,请尝试在此处直接从 GitHub 存储库安装。

编辑:我测试了使用存储库进行安装,问题已解决。我建议你也这样做。如果您不确定如何执行此操作,请随时询问。

最新更新