Python &引用;导入错误:没有名为“BeautifulSoup”的模块;即使在安装后也会出错
我遇到以下错误:Python &引用;导入错误:没有名为“BeautifulSoup”的模块;即使在安装后也会出错,python,module,beautifulsoup,failed-installation,Python,Module,Beautifulsoup,Failed Installation,我遇到以下错误: Traceback (most recent call last): File "C:\Python27\files\samplefileoutput.py", line 1, in <module> import BeautifulSoup ImportError: No module named BeautifulSoup 我认为我的安装是成功的。我使用的是Windows 7 PC。我提取了源tarball,然后在将目录更改为提取的Beautifu
Traceback (most recent call last):
File "C:\Python27\files\samplefileoutput.py", line 1, in <module>
import BeautifulSoup
ImportError: No module named BeautifulSoup
我认为我的安装是成功的。我使用的是Windows 7 PC。我提取了源tarball,然后在将目录更改为提取的BeautifulSoup文件夹后,通过命令行键入“setup.py install”。安装过程中似乎没有错误消息。它以这一行结束:
Writing C:\Python27\Lib\site-packages\beautifulsoup4-4.3.2-py2.7.egg-info
有人能提供一些指导吗?谢谢 Beauty Soup 4的模块是
bs4
from bs4 import BeautifulSoup
将起作用,或
import bs4
如果要导入整个模块。只需运行:
pip install BeautifulSoup
我是在命令行还是在shell中键入这个?这个指令是做什么的?谢谢@JerryCarson:将
导入BeautifulSoup
(在脚本中)替换为导入bs4
(如果我没有记错的话)。或者,您可能希望安装Beauty Soup的早期版本(v4之前)。的可能副本
pip install BeautifulSoup