首页 文章

'BeautifulSoup'没有属性'__version__'

提问于
浏览
1

同时使用jupyter笔记本使用代码

from bs4 import BeautifulSoup
print ("BeautifulSoup version:%6.6s" %BeautifulSoup.__version__)

我收到了这个错误

AttributeError:类型对象'BeautifulSoup'没有属性'version'

我使用python setup.py install安装了bs4 . 它在安装中显示“c:\ users ... \ anaconda3 \ lib \ site-packages \ beautifulsoup4-4.4.1-py3.5.egg”

1 回答

  • 5

    对于 BeautifulSoup 版本4,你应该这样做:

    >>> import bs4
    >>> print ("BeautifulSoup version:%6.6s" % bs4.__version__)
    BeautifulSoup version: 4.4.1
    

相关问题