我如何从 bs4 导入 BeautifulSoup? [英] How can I from bs4 import BeautifulSoup?
本文介绍了我如何从 bs4 导入 BeautifulSoup?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此代码:
from bs4 import BeautifulSoup
不起作用,并出现此错误:
Doesn't work, and gives this error :
raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__,attr)
^
SyntaxError: invalid syntax
我该怎么办?
推荐答案
你应该使用pip
来安装,所以你可以简单地做
You should be using pip
to install, so you can simply do
pip install beautifulsoup4
这将安装最新的 BS4,即 2013-08-15 的 4.3.1.它支持 Python 3.
That will install the latest BS4, which is 4.3.1 as of 2013-08-15. It supports Python 3.
这篇关于我如何从 bs4 导入 BeautifulSoup?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文