即使安装了 BeautifulSoap 的 ImportError
ImportError for BeautifulSoap even when installed
我一直在尝试使用
导入 BeautifulSoap(Beautiful Soap 4,而不是 3)
from bs4 import BeautifulSoap
但我不断收到 ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'BeautifulSoap'
我已经通过 pip install bs4
和 pip install --upgrade --force-reinstall beautifulsoup4
用 pip 安装了 BeautifulSoap4。出于某种原因,pip install beautifulsoap4
给了我:
Could not find a version that satisfies the requirement beautifulsoap4 (from versions: )
No matching distribution found for beautifulsoap4
无论如何,使用 import bs4
导入 bs4 不会给我任何错误。我的 Python 个文件中的 None 个被命名为 bs4.py 或 beautifulsoap.py 或任何类似的名称。有谁知道为什么会这样?我一直在寻找过去一个小时的原因:(
提前致谢!
pip install bs4
和 pip install beautifulsoap4
都没有安装 BeautifulSoup (Soup != Soap)
命令是
pip install beautifulsoup4
from bs4 import BeautifulSoup
勾选Docs
如果你通过pip搜索名称,你可以看到:
点搜索 bs4:
bs4 (0.0.1) - Dummy package for Beautiful Soup
pip search beautifulsoup4
beautifulsoup4 (4.6.0) - Screen-scraping library
你有错字BeautifulSoup
正确的是from bs4 import BeautifulSoup
我一直在尝试使用
导入 BeautifulSoap(Beautiful Soap 4,而不是 3)from bs4 import BeautifulSoap
但我不断收到 ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'BeautifulSoap'
我已经通过 pip install bs4
和 pip install --upgrade --force-reinstall beautifulsoup4
用 pip 安装了 BeautifulSoap4。出于某种原因,pip install beautifulsoap4
给了我:
Could not find a version that satisfies the requirement beautifulsoap4 (from versions: )
No matching distribution found for beautifulsoap4
无论如何,使用 import bs4
导入 bs4 不会给我任何错误。我的 Python 个文件中的 None 个被命名为 bs4.py 或 beautifulsoap.py 或任何类似的名称。有谁知道为什么会这样?我一直在寻找过去一个小时的原因:(
提前致谢!
pip install bs4
和 pip install beautifulsoap4
都没有安装 BeautifulSoup (Soup != Soap)
命令是
pip install beautifulsoup4
from bs4 import BeautifulSoup
勾选Docs
如果你通过pip搜索名称,你可以看到: 点搜索 bs4:
bs4 (0.0.1) - Dummy package for Beautiful Soup
pip search beautifulsoup4
beautifulsoup4 (4.6.0) - Screen-scraping library
你有错字BeautifulSoup
正确的是from bs4 import BeautifulSoup