2012-09-30 57 views
0

我有python 2.7.3安裝到Mac OS 10.8。所有的文件都在/Library/Frameworks/Python.framework/Versions/2.7/ ...MacOS 10.8 Python站點包Eclipse Eclipse Geek_tools

我安裝的setuptools-0.6c11-py2.7具有以下/.pydistutils.cfg:

[install] 
install_lib = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages 
install_scripts = ~/bin 

我還使用安裝了PyDev的Eclipse Indigo Service Release 1。 Python解釋器設置如下:

Name: Python2.7 Location: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python 
System PYTHONPATH: 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages 

現在。我想安裝python_twitter-0.8.2-py2.7包。我下載這些文件。運行python setup.py安裝命令

一切順利,我在我的站點包中有一個python_twitter-0.8.2-py2.7.egg,我在easy-install.pth中有它,但Eclipse對於未解決的問題感到憤怒進口當我這樣做:

import twitter 
import oauth2 
import simplejson 

[注:的oauth2,simplejson是Twitter的庫的依賴關係]

錯在何處?

另一件事。當我創建作爲野人工具shell窗口並運行下面的代碼Python文件:

import sys 

for pth in sys.path: 
    print pth 

我收到:

/Users/{Username}/Documents/Eclipse/{package name}/src 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages 
/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload 
/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC 

,但是當我運行在終端我相同的命令相同的文件收到:

/Users/Mihails/Documents/Eclipse/Console/src 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/httplib2-0.7.6-py2.7.egg 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/python_twitter-0.8.2-py2.7.egg 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2-1.5.211-py2.7.egg 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/simplejson-2.6.2-py2.7-macosx-10.6-intel.egg 
/usr/local/lib/wxPython-ansi-2.8.12.1/lib/python2.7/site-packages 
/usr/local/lib/wxPython-ansi-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-ansi 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages 
/usr/local/lib/wxPython-ansi-2.8.12.1/lib/python2.7 

底線。

當我嘗試在Eclipse中運行我的項目時,它會爲似乎要安裝的庫提供一個ImpoerError。

當我通過極客工具運行我的項目時,我甚至沒有sys.path中的站點包。

當我從終端運行我的項目時,一切都很精彩。

出了什麼問題?以及如何使項目以與Eclipse,Terminal和Geek Tools完全相似的方式運行?

我就像試圖找出2天...請任何人......

+0

你確定*這些是列出的實際路徑?第一組列表看起來非常像Apple提供的'/ usr/bin/python2.7',除非它們都應該以'/ System/Library/Frameworks'開頭,而不是'/ Library/Frameworks'。那是兩個不同的地點;後者是安裝python.org或其他第三方Python的地方。 –

回答

0

嘗試取出並在窗口>首選項>的PyDev>解釋加入您的解釋 - Python和檢查那裏的路...

如果它沒有抓住正確的路徑,您可以嘗試在那裏手動設置它們。