这段代码:
from bs4 import BeautifulSoup
不起作用,并给出此错误:
raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__,attr)
^
SyntaxError: invalid syntax
我该怎么办?
最佳答案
你应该使用 pip
来安装,所以你可以简单地做
pip install beautifulsoup4
这将安装最新的 BS4,截至 2013 年 8 月 15 日为 4.3.1。它支持 Python 3。
关于python - 我怎样才能从 bs4 导入 BeautifulSoup?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18831380/