ModuleNotFoundError: No module named ‘bs4‘

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

1、安装bs4

pip install beautifulsoup4

ModuleNotFoundError: No module named ‘bs4‘_第1张图片
之后,在可以在本地python工作路径的相应目录下找到已安装的bs4模块
ModuleNotFoundError: No module named ‘bs4‘_第2张图片
运行依然报错:
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–+
ModuleNotFoundError: No module named ‘bs4‘_第3张图片
依然报错。

3、根源

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

你可能感兴趣的:(pycharm,python)