AttributeError:模块“ bs4”在python 3.7.2中没有属性“ BeautifulSoup”

时间:2019-02-09 05:36:08

标签: python-3.7

import bs4 as bs
import urllib.request

site = urllib.request.urlopen('https://pythonprogramming.net/parsememcparseface/').read()

soup = bs.BeautifulSoup(site,'lxml')

print(soup)

这是我要运行的代码,得到的错误是:

Traceback (most recent call last):
  File "C:/Users/rach/AppData/Local/Programs/Python/Python37/test.py", line 1, in <module>
    import bs4 as bs
  File "C:/Users/rach/AppData/Local/Programs/Python/Python37\bs4.py", line 6, in <module>
    soup = bs.BeautifulSoup(sauce, 'lxml')
AttributeError: module 'bs4' has no attribute 'BeautifulSoup'

我已经安装了bs4和lxml。请帮忙。谢谢。

0 个答案:

没有答案