简体   繁体   中英

“No module named 'bs4'” Even though bs4 is already satisfied on python 3.7?I

I already have bs4 installed for anaconda and python 3, however when running some code in vscode it says that it can't find the bs4 module.

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): –

It smells to me like you have multiple pyhton versions:

  1. in visual code type Ctrl+Shift+P

  2. selecte Python select interpreter

在此处输入图像描述

  1. From the list (sample image) Select Python 3.7.

You were getting the error because you installed it for 3.8, not 3.7在此处输入图像描述

Source: VS Doc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM