【问题标题】:Google Cloud Logging in Python - ImportErrorPython 中的 Google Cloud Logging - ImportError
【发布时间】:2017-03-17 10:10:48
【问题描述】:

尝试在 Python 中导入 Google Cloud Logging 时出现以下错误:

from google.cloud import logging
  File "/usr/local/lib/python3.6/site-packages/google/cloud/logging/__init__.py", line 21, in <module>
    from google.cloud.logging.client import Client
  File "/usr/local/lib/python3.6/site-packages/google/cloud/logging/client.py", line 32, in <module>
    from google.cloud.client import ClientWithProject
ImportError: cannot import name 'ClientWithProject'

我让它在虚拟环境中运行 在 requirements.txt 中有这个:

google-cloud-logging>=0.20.0

【问题讨论】:

    标签: google-cloud-logging


    【解决方案1】:

    我能够通过以下方式解决下一个错误:

    pip3 install --upgrade google-cloud-logging

    对于 Python 3 和:

    pip install --upgrade google-cloud-logging

    适用于 Python 2.7

    【讨论】:

      【解决方案2】:

      尝试更新你的谷歌云组件,以管理员身份在终端运行:

       gcloud components update
      

      【讨论】:

        【解决方案3】:

        我必须在 google-cloud-logging 和 google-cloud-storage 之上安装 dataproc。
        Python3 pip3 install mrjob google-cloud-dataproc google-cloud-logging google-cloud-storage
        Python2.7 pip3 install mrjob google-cloud-dataproc google-cloud-logging google-cloud-storage

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-07-07
          • 1970-01-01
          • 2017-08-17
          • 1970-01-01
          相关资源
          最近更新 更多