ModuleNotFoundError: No module named ‘bs4‘

PyCharm项目:ModuleNotFoundError: No module named ‘bs4’
解决办法:

1、安装bs4

pip install beautifulsoup4

在这里插入图片描述
之后,在可以在本地python工作路径的相应目录下找到已安装的bs4模块
在这里插入图片描述
运行依然报错:
ImportError: cannot import name ‘BeautifulS’ from ‘bs4’
(C:\Users\l\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4_init_.py)

2、配置Interpreter

PyCharm–File–Settings–Python Interpreter–+
在这里插入图片描述
依然报错。

3、根源

代码:from bs4 import BeautifulS
修改为:from bs4 import BeautifulSoup
解决!

猜你喜欢

转载自blog.csdn.net/weixin_47542175/article/details/113842868
今日推荐