【问题标题】:No module named 'google.cloud._helpers' on GCEGCE 上没有名为“google.cloud._helpers”的模块
【发布时间】:2018-11-06 13:57:08
【问题描述】:

在 GCE 上导入 google.cloud.bigquery 时出现错误。 它没有发生在不是 GCE 的环境中。 我使用pip 执行了更新。

你知道为什么吗?

user1@sv1:~$ python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016,12:22:00) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> from google.cloud import bigquery

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "/home/user1/miniconda3/lib/python3.6/site-packages/google/cloud/bigquery/__init__.py", line 34, in <module>
from google.cloud.bigquery.client import Client
File "/home/user1/miniconda3/lib/python3.6/site-packages/google/cloud/bigquery/client.py", line 32, in <module>
import google.cloud._helpers

ModuleNotFoundError:没有名为“google.cloud._helpers”的模块

2018 年 11 月 11 日添加 谢谢你的回答。 自从使用 pyenv 创建一个新的 python 后它就不起作用了,我认为我的服务器有问题。 我重置服务器并重试。

【问题讨论】:

  • 你能包含pip freeze的输出吗?

标签: google-bigquery google-compute-engine google-cloud-python


【解决方案1】:

2018 年 6 月,Google 弃用了 google.cloud Python 包。您需要直接使用 BigQuery 模块,直接使用pip install --upgrade google-cloud-bigquery,而不是pip install --upgrade google-cloud

更多信息here

【讨论】:

    【解决方案2】:

    你在哪里运行这个脚本?您是否尝试过设置 virtualenv 并在那里运行它?这一切似乎都可能与 te Python 版本或冲突的包有关。

    例如,从 Cloud Shell 运行相同的程序没有问题(无需安装任何库,也无需为此使用 virtualenv):

    $ python
    Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
    [GCC 6.3.0 20170516] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from google.cloud import bigquery
    >>>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-07
      • 2020-12-18
      • 1970-01-01
      • 2021-02-03
      • 2019-07-16
      • 1970-01-01
      • 2017-03-21
      • 1970-01-01
      相关资源
      最近更新 更多