我使用 pycharm 并创建了一个 scrap.py 文件。在这个文件中我想导入 beautifulsoup4。在 pycharm 中,我确实使用了项目 interpereter 并添加了 beautifulsoup4。 之后,我希望在我的代码中导入 beautifulsoup4 包,但它给出了一个错误:
Traceback (most recent call last):
File "C:/Users/Arthur/.PyCharmCE2018.3/config/scratches/scratch.py", line 2, in <module>
import beautifulsoup
ModuleNotFoundError: No module named 'beautifulsoup'
我尝试了命令提示符,也成功使用 pip install --upgrade beautifulsoup4 安装
import os
import beautifulsoup
最佳答案
根据official documentation导入Beautiful Soup 4的正确方法如下:
from bs4 import BeautifulSoup
关于python - pycharm安装beautifulsoup后导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54608891/