Python 属性错误:模块';grpc.实验性.aio';没有属性';StreamUnaryCall';-谷歌NLP API

Python 属性错误:模块';grpc.实验性.aio';没有属性';StreamUnaryCall';-谷歌NLP API,python,google-cloud-platform,Python,Google Cloud Platform,我想从Google NLP API运行脚本: 我得到以下错误: Traceback (most recent call last): File "/Users/myuser/Desktop/g.py", line 1, in <module> from google.cloud import language_v1 File "/Library/Frameworks/Python.framework/Versions/3.8/lib/p

我想从Google NLP API运行脚本:

我得到以下错误:

Traceback (most recent call last):
  File "/Users/myuser/Desktop/g.py", line 1, in <module>
    from google.cloud import language_v1
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/cloud/language_v1/__init__.py", line 19, in <module>
    from google.cloud.language_v1.gapic import language_service_client
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/cloud/language_v1/gapic/language_service_client.py", line 24, in <module>
    import google.api_core.gapic_v1.client_info
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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 "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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 "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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'
[Finished in 1.6s with exit code 1]
[cmd: ['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3', '-u', '/Users/myuser/Desktop/g.py']]
[dir: /Users/myuser/Desktop]
[path: /Users/myuser/opt/miniconda3/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin]
回溯(最近一次呼叫最后一次):
文件“/Users/myuser/Desktop/g.py”,第1行,在
从google.cloud导入语言_v1
文件“/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site packages/google/cloud/language_v1/_init__.py”,第19行
来自google.cloud.language\u v1.gapic导入语言\u服务\u客户端
文件“/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site packages/google/cloud/language\u v1/gapic/language\u service\u client.py”,第24行
导入google.api_core.gapic_v1.client_信息
文件“/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site packages/google/api_core/gapic_v1/_init__.py”,第26行
来自google.api_core.gapic_v1导入方法_async#noqa:F401
文件“/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site packages/google/api\u core/gapic\u v1/method\u async.py”,第20行
从google.api\u core导入通用帮助程序、grpc\u帮助程序\u异步
文件“/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site packages/google/api\u core/grpc\u helpers\u async.py”,第145行,在
类WrappedStreamUnaryCall(WrappedUnaryResponseMixin,WrappedStreamRequestMixin,aio.StreamUnaryCall):
AttributeError:模块“grpc.experimental.aio”没有属性“StreamUnaryCall”
[在1.6s内完成,退出代码为1]
[cmd:['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3','-u','/Users/myuser/Desktop/g.py']]
[dir:/Users/myuser/Desktop]
[路径:/Users/myuser/opt/miniconda3/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/opt/X11/bin]
我还意识到它在路径“miniconda3”中显示,但我已经卸载了miniconda3


有什么帮助吗?谢谢大家!

我在图书馆的一个错误中意识到了这一点

要解决此问题,您需要安装最新版本:

pip3安装grpcio==1.32.0

你完成了:)