Python 即使已安装,也可导入BeautifulSoap

Python 即使已安装,也可导入BeautifulSoap,python,pip,importerror,Python,Pip,Importerror,我一直在尝试用 来自bs4导入的ULSOAP 但我一直感到恐惧: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'BeautifulSoap' 不管怎样,只要用import bs4import bs4导入bs4,我就不会出错。我的Python文件都没有命名为bs4.py或beautifulsoap.py或类似的名

我一直在尝试用

来自bs4导入的ULSOAP

但我一直感到恐惧:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'BeautifulSoap'
不管怎样,只要用import bs4
import bs4
导入bs4,我就不会出错。我的Python文件都没有命名为bs4.py或beautifulsoap.py或类似的名称。有人知道为什么会这样吗?在过去的一个小时里,我一直在寻找原因:(


提前感谢!

无论是
pip安装bs4还是
pip安装beautifulsoap4
安装beautifulsoap4(Soup!=Soap)

命令是
pip安装程序4

检查

如果按pip搜索名称,可以看到: pip搜索bs4:

bs4(0.0.1)-精美汤的虚拟包装

beautifulsoup4(4.6.0)-屏幕刮取库


您输入了
beautifulsou


正确的是来自bs4导入BeautifulSoup的

@Shawnley仔细阅读命令,它不是soap,它是
beautifulsoup4
,非常感谢……浪费生命的最后一个小时让我觉得很愚蠢,因为我认为soap==汤!哇,我是个白痴。出于某种愚蠢的原因,我认为这个库被称为BeautifulSoup。谢谢各位
Could not find a version that satisfies the requirement beautifulsoap4 (from versions: )
No matching distribution found for beautifulsoap4
from bs4 import BeautifulSoup
pip search beautifulsoup4