安装后,"ImportError:没有名为BeautifulSoup的模块"错误

Jer*_*son 4 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
Run Code Online (Sandbox Code Playgroud)

当我尝试运行以下文件时:

import BeautifulSoup
f = open('c:\output.txt', 'a')
f.write('Hello World!\n')
f.close()
Run Code Online (Sandbox Code Playgroud)

我以为我的安装成功了.我使用的是Windows 7 PC.我解压缩了源tarball,然后通过命令行输入"setup.py install",一旦我将目录更改为提取的BeautifulSoup文件夹.安装过程中似乎没有出现错误消息.它完成了这一行:

Writing C:\Python27\Lib\site-packages\beautifulsoup4-4.3.2-py2.7.egg-info
Run Code Online (Sandbox Code Playgroud)

有人可以提供一些指导吗?谢谢!

mip*_*adi 8

美丽的汤4的模块是bs4.

from bs4 import BeautifulSoup
Run Code Online (Sandbox Code Playgroud)

会工作,或

import bs4
Run Code Online (Sandbox Code Playgroud)

如果要导入整个模块.