我做到sudo pip install BeautifulSoup4
了,得到了非常乐观的回应:
Downloading/unpacking beautifulsoup4
Running setup.py egg_info for package beautifulsoup4
Installing collected packages: beautifulsoup4
Running setup.py install for beautifulsoup4
Successfully installed beautifulsoup4
Cleaning up..
但是当我尝试在脚本中使用import BeautifulSoup4
或from BeautifulSoup4 import BeautifulSoup4
时,python 说没有该名称的模块。
> import BeautifulSoup
ImportError: No module named BeautifulSoup
更新:pip
告诉我beautifulsoup4 in /usr/local/lib/python2.6/dist-packages
,但我正在运行 2.7.2+(并print sys.path
看到 2.7 路径)......所以现在我需要弄清楚为什么pip
把东西放在错误的地方。