无法在 Python 3.6 中导入 Beautiful Soup
Can't import Beautiful Soup in Python 3.6
我正在使用 Ubuntu,我刚刚使用 apt
通过 运行 命令 sudo apt-get install python3-bs4
安装 Beautiful Soup。 Runnig apt list --installed | grep bs4
给出以下输出:
python3-bs4/xenial,xenial,now 4.4.1-1 all [installed]
尽管如此,我还是无法导入 bs4。这是代码和与之相关的错误:
>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'bs4'
您可能需要将 Beautiful Soup 4 pip 安装到您的虚拟环境中。
pip install beautifulsoup4
我正在使用 Ubuntu,我刚刚使用 apt
通过 运行 命令 sudo apt-get install python3-bs4
安装 Beautiful Soup。 Runnig apt list --installed | grep bs4
给出以下输出:
python3-bs4/xenial,xenial,now 4.4.1-1 all [installed]
尽管如此,我还是无法导入 bs4。这是代码和与之相关的错误:
>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'bs4'
您可能需要将 Beautiful Soup 4 pip 安装到您的虚拟环境中。
pip install beautifulsoup4