为什么我不能使用python 2.7在使用pip和/或easy_install安装后使用python 2.7导入beautifulsoup?

时间:2012-12-15 11:55:44

标签: python python-2.7 beautifulsoup pip easy-install

$ sudo pip install beautifulsoup4
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Cleaning up...

我安装了beautifulsoup4,似乎已成功完成但我无法导入它:

Python 2.7.3 (v2.7.3:70, Apr  9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import beautifulsoup4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named beautifulsoup4
>>> import beautifulsoup
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named beautifulsoup

1 个答案:

答案 0 :(得分:5)

该模块名为bs4

from bs4 import BeautifulSoup