gpt4 book ai didi

python - 使用grpc和cloud-datastore时如何修复App Engine Flex中的AttributeError?

转载 作者:行者123 更新时间:2023-12-03 13:50:17 24 4
gpt4 key购买 nike

当我使用Google App Engine Flex部署python3应用程序时,出现以下错误:

  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/vmagent/app/run.py", line 8, in <module>
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
File "/home/vmagent/app/application/__init__.py", line 43, in create_app
from .main import main as main_blueprint
File "/home/vmagent/app/application/main/__init__.py", line 5, in <module>
from . import cron_jobs, views
File "/home/vmagent/app/application/main/cron_jobs.py", line 4, in <module>
from google.cloud import datastore
File "/env/lib/python3.6/site-packages/google/cloud/datastore/__init__.py", line 60, in <module>
from google.cloud.datastore.batch import Batch
File "/env/lib/python3.6/site-packages/google/cloud/datastore/batch.py", line 24, in <module>
from google.cloud.datastore import helpers
File "/env/lib/python3.6/site-packages/google/cloud/datastore/helpers.py", line 29, in <module>
from google.cloud.datastore_v1.proto import datastore_pb2
File "/env/lib/python3.6/site-packages/google/cloud/datastore_v1/__init__.py", line 18, in <module>
from google.cloud.datastore_v1.gapic import datastore_client
File "/env/lib/python3.6/site-packages/google/cloud/datastore_v1/gapic/datastore_client.py", line 18, in <module>
import google.api_core.gapic_v1.client_info
File "/env/lib/python3.6/site-packages/google/api_core/gapic_v1/__init__.py", line 26, in <module>
from google.api_core.gapic_v1 import method_async # noqa: F401
File "/env/lib/python3.6/site-packages/google/api_core/gapic_v1/method_async.py", line 20, in <module>
from google.api_core import general_helpers, grpc_helpers_async
File "/env/lib/python3.6/site-packages/google/api_core/grpc_helpers_async.py", line 145, in <module>
class _WrappedStreamUnaryCall(_WrappedUnaryResponseMixin, _WrappedStreamRequestMixin, aio.StreamUnaryCall):
AttributeError: module 'grpc.experimental.aio' has no attribute 'StreamUnaryCall'

我的 requirements.txt文件包括以下内容:

google-cloud-datastore==1.12.0
grpcio==1.27.2

我使用grpcio版本1.27.2而不是最新的1.29.0的原因是因为 here显示了信息

有人可以帮忙吗?

最佳答案

我刚刚遇到了相同的问题,因此这可能会对您有所帮助。我注意到google-api-core也是一个依赖项,并且最近进行了更新(特别是在grpc_helpers_async周围),因此我将其固定到版本1.17.0即可解决此问题。只需将其添加到您的要求中即可:

google-api-core==1.17.0

关于python - 使用grpc和cloud-datastore时如何修复App Engine Flex中的AttributeError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62223582/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com