【问题标题】:unresolved import gcs_oauth2_boto_plugin未解决的导入 gcs_oauth2_boto_plugin
【发布时间】:2016-05-26 03:41:40
【问题描述】:

我目前正在尝试使用 Python 和 Google 在此链接上提供的文档在 Google Cloud Storage 中创建存储桶。

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

我已按照说明进行操作,并且已成功安装独立 gsutil。但是,一旦我进入eclipse并导入gcs_oauth2_boto_plugin,即使它识别到import boto,它也无法识别它。

【问题讨论】:

  • 你能在 Eclipse 之外导入 gcs_oauth2_boto_plugin 吗?你的 PYTHONPATH 上有 gcs_oauth2_boto_plugin 吗?
  • 不知道你的意思?我的 PYTHONPATH 在哪里?怎么改?
  • docs.python.org/2/using/cmdline.html#environment-variables 描述了一些基础知识。简而言之,如果你要导入一个模块,它需要对你正在使用的 Python 解释器可见。

标签: python-2.7 google-cloud-storage


【解决方案1】:

这是我的 PYTHON PATH 和 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路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-01
    • 2015-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-28
    • 1970-01-01
    • 2011-02-28
    相关资源
    最近更新 更多