欢迎访问我搞事情的【知乎账号】:Coffee 以及我的【B站漫威剪辑账号】:VideosMan 若我的笔记对你有帮助,请用小小的手指,点一个大大的赞哦。
以下是我觉得比较常规的方法,如果你用的是从微软商店下载的Python,要特别注意,往下看就明白了
我使用pip安装好了buautifulsoup4,可vscode就是识别不了

上面的图片,cmd进入了python后,导入from bs4 import BeautifulSoup ,没有报错,说明buautifulsoup4是没有问题的,可是我的vscode就是识别不了

vscode的思路是要在setting.json 文件里面,添加你的拓展路径,以下是解决方法
第一步
你的下载的beautifulsoup4 文件包,先解压到你的python工作项目里面 
第二步
按住ctrl+shift+P ,然后搜setting.json ,然后在你自己这个json配置文件里面,添加以下这个配置代码(我加在了最后一行)
"python.analysis.extraPaths": ["输入你的beautifulsoup路径"]
 保存好了后,重启vscode  vscode就能识别这个bs4了
特别注意
知乎上铺天盖地都说微软商店的python是保姆级安装方式,其实在Microsoft Store下载,有东西你是要注意的。
如果你是从微软商店Microsoft Store下载的python,要点击vscode最下面的设置  点击vscode下面的python版本号,我的是3.10.6 ,然后vscode会提供python不同的解释器,如果你在微软商店上下载的python,就默认是这个带星星的解释器,你换成Global 的解释器后,你会发现你遇到的问题屁事都没有(在官网上下载的安装包,其实也不麻烦)
补充知识
pip安装、卸载beautifulsoup4
在cmd使用pip安装(以下随便挑一种方法进行安装)
C:\Users\admin>pip install beautifulsoup4
C:\Users\admin>pip3 install beautifulsoup4
C:\Users\admin>python -m pip install beautifulsoup4
C:\Users\admin>python3 -m pip install beautifulsoup4
C:\Users\admin>python3 -m pip3 install beautifulsoup4
查看是否安装成功
pip list
列表里面有beautiful4就可以了 
卸载beautifulsoup4
类似的,添加一个install改成uninstall即可
C:\Users\admin> pip uninstall beautifulsoup4
|