ImportError:没有名为bs4的模块

时间:2014-09-06 05:35:54

标签: python beautifulsoup

我在OSX中使用pip安装了BeautifulSoup4,但我收到了这个错误:

dyn-72-33-214-45:craiglist mona$ python t1.py 
Traceback (most recent call last):
  File "t1.py", line 1, in <module>
    from bs4 import BeautifulSoup
ImportError: No module named bs4

知道怎么解决吗?

dyn-72-33-214-45:craiglist mona$ pip install BeautifulSoup4
....
Successfully installed BeautifulSoup4
Cleaning up...

1 个答案:

答案 0 :(得分:3)

我使用easy_install安装它,现在它正在运行。但首先您应该使用sudo su

dyn-72-33-214-45:craiglist mona$ sudo su
sh-3.2# easy_install beautifulsoup4