2016-04-22 56 views
0

我目前正在創建使用Python和由谷歌在此鏈接這裏提供的文檔中的谷歌Cloud Storage桶。懸而未決進口gcs_oauth2_boto_plugin

https://cloud.google.com/storage/docs/gspythonlibrary

我按照說明,我已經成功地安裝了獨立的gsutil。但是,一旦我進入eclipse並導入gcs_oauth2_boto_plugin,即使它識別導入boto,它也不會識別它。

+0

你可以在Eclipse之外導入gcs_oauth2_boto_plugin嗎?你的PYTHONPATH上是否有gcs_oauth2_boto_plugin? –

+0

我不知道你的意思?我的PYTHONPATH在哪裏?我如何改變它? –

+0

https://docs.python.org/2/using/cmdline.html#environment-variables描述了一些基礎知識。簡而言之,如果你要導入一個模塊,它需要對你正在使用的Python解釋器可見。 –

回答

0

正是有了我的兩個python路徑和Eclipse的一個問題。我最終做的是

import sys 
sys.path.append("/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages") 
try: 
    import boto 
    from boto import connect_gs 
except: 
    print 'neither of the modules were imported' 

這解決了我的問題。更新python路徑沒有。