标签:
>>> import sys >>> sys.path [‘‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload‘, ‘/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC‘, ‘/Library/Python/2.7/site-packages‘]
然而spyder显示:
import sys sys.path Out[2]: [‘‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/utils/external‘, ‘/Library/Python/2.7/site-packages‘, ‘/Applications/Spyder.app/Contents/Resources‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python27.zip‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/plat-darwin‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/plat-mac‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/lib-tk‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/lib-old‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/lib-dynload‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/site-packages.zip‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/site-packages‘, ‘/Applications/Spyder.app/Contents/Resources/lib/python2.7/IPython/extensions‘, ‘/Users/jyy/.ipython‘]
安装的package放在/Library/Python/2.7/site-packages目录下,进入可以看到bs4的文件夹(主要是.pyc和.py文件)。然而spyder默认的路径则不在这目录下,解决办法是在spyder的PYTHONPATH manager 中加入该路径即可。
标签:
原文地址:http://www.cnblogs.com/yyjiang/p/beautifulsoup.html