【发布时间】:2020-01-16 07:56:59
【问题描述】:
导入 apache beam 的 google 数据存储 api 时出现导入错误。我的 Windows 10 64 位系统上安装了一个版本的 Python 3。
有人可以帮助我吗?我试图解决它,但我不能
# -*- coding: utf-8 -*-
import apache_beam as beam
from apache_beam.io.gcp.datastore.v1new.datastoreio import ReadFromDatastore, WriteToDatastore
from apache_beam.options.pipeline_options import GoogleCloudOptions
from apache_beam.options.pipeline_options import PipelineOptions
我的错误信息是这样的
Traceback (most recent call last):
File "C:\Work\test.py", line 3, in <module>
from apache_beam.io.gcp.datastore.v1new.datastoreio import ReadFromDatastore, WriteToDatastore
File "C:\Work\VENV\venv\lib\site-packages\apache_beam\io\gcp\datastore\v1new\datastoreio.py", line 40, in <module>
from apache_beam.io.gcp.datastore.v1new import helper
File "C:\Work\VENV\venv\lib\site-packages\apache_beam\io\gcp\datastore\v1new\helper.py", line 33, in <module>
from google.cloud import environment_vars
ModuleNotFoundError: No module named 'google.cloud'
这是点子列表
Package Version
------------------------ ----------
apache-beam 2.17.0
avro-python3 1.9.1
cachetools 4.0.0
certifi 2019.11.28
chardet 3.0.4
crcmod 1.7
dill 0.3.0
docopt 0.6.2
fastavro 0.21.24
future 0.18.2
google-api-core 1.16.0
google-api-python-client 1.7.11
google-auth 1.10.1
google-auth-httplib2 0.0.3
googleapis-common-protos 1.51.0
grpcio 1.26.0
hdfs 2.5.8
httplib2 0.12.0
idna 2.8
mock 2.0.0
numpy 1.18.1
oauth2client 3.0.0
pbr 5.4.4
pip 19.0.3
protobuf 3.11.2
pyarrow 0.15.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
pydot 1.4.1
pymongo 3.10.1
pyparsing 2.4.6
python-dateutil 2.8.1
pytz 2019.3
requests 2.22.0
rsa 4.0
setuptools 40.8.0
six 1.14.0
uritemplate 3.0.1
urllib3 1.25.7
请帮我解决我的问题。之前谢谢你
【问题讨论】:
-
如果您还没有安装
pip install apache-beam[gcp],请尝试安装。 -
尝试 pip install google-cloud 并运行 gcloud 组件更新 - cloud.google.com/sdk/gcloud/reference/components/update
标签: python google-cloud-datastore google-cloud-dataflow