即使在python 3.7上已经满足bs4的要求,“没有名为'bs4'的模块”?

时间:2020-04-22 02:48:03

标签: python

我已经为anaconda和python 3安装了bs4,但是在vscode中运行某些代码时,它说找不到bs4模块。

Successful Traceback in shell
Requirement already satisfied: beautifulsoup4 in /opt/anaconda3/lib/python3.7/site-packages (from bs4) (4.9.0)
Requirement already satisfied: soupsieve>1.2 in /opt/anaconda3/lib/python3.7/site-packages (from beautifulsoup4->bs4) (1.9.3)
(base) Joshuas-MacBook-Pro:~ joshuag$ 

Fail traceback in VSCode
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /Users/joshuag/PycharmProjects/ThingsToKnow/WebScraping.py (base) Joshuas-MacBook-Pro:PycharmProjects joshuag$ /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /Users/joshuag/PycharmProjects/ThingsToKnow/WebScraping.py Traceback (most recent call last): –

1 个答案:

答案 0 :(得分:1)

对我来说,就像您有多个pyhton版本一样:

  1. 以可视代码类型Ctrl+Shift+P

  2. 选择Python选择解释器

enter image description here

  1. 从列表中(示例图像) 选择Python 3.7。

由于安装了3.8(而不是3.7)而收到错误 enter image description here

来源:VS Doc