Google 云登录 Python - ImportError

Google Cloud Logging in Python - ImportError

尝试在 Python 中导入 Google 云登录时出现以下错误:

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

我能够通过以下方式找到下一个错误:

pip3 install --upgrade google-cloud-logging

对于 Python 3 和:

pip install --upgrade google-cloud-logging

对于 Python 2.7

尝试更新您的 google 云组件,运行 在终端中以管理员身份:

 gcloud components update

我必须在 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