我用命令安装BeautifulSoup:
sudo easy_install BeautifulSoup4
我得到的消息:
Searching for BeautifulSoup4
Best match: beautifulsoup4 4.1.3
Processing beautifulsoup4-4.1.3-py2.6.egg
beautifulsoup4 4.1.3 is already the active version in easy-install.pth
Using /Library/Python/2.6/site-packages/beautifulsoup4-4.1.3-py2.6.egg
Processing dependencies for BeautifulSoup4
Finished processing dependencies for BeautifulSoup4
我试图导入BeautifulSoup库。
>>> from BeautifulSoup import BeautifulSoup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named BeautifulSoup
要么:
>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bs4
我的Python版本是:
python --version
Python 2.7.3
编辑
我明白那个:
Using /Library/Python/2.6/site-packages/beautifulsoup4-4.1.3-py2.6.egg
可能意味着存在的Python版本之间有冲突
我怎么能有这样的模块注册? 谢谢