简体   繁体   English

谷歌云文本语音“没有属性'SynthesisInput'”错误

[英]Google cloud texttospeech "has no attribute 'SynthesisInput'" error

https://cloud.google.com/text-to-speech/docs/libraries?hl=pt-br#client-libraries-install-python https://cloud.google.com/text-to-speech/docs/libraries?hl=pt-br#client-libraries-install-python

While trying the main Google example, I got this error:在尝试主要的谷歌示例时,我收到了这个错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-92-866a7868dbb4> in <module>
     10 
     11 # Set the text input to be synthesized
---> 12 synthesis_input = texttospeech.SynthesisInput(text="Hello, World!")
     13 
     14 # Build the voice request, select the language code ("en-US") and the ssml

AttributeError: module 'google.cloud.texttospeech' has no attribute 'SynthesisInput'

Any sugestions?有什么建议吗? Using conda-forge: google-cloud-texttospeech 1.0.1使用 conda-forge:google-cloud-texttospeech 1.0.1

I tried your example using the same library (google-cloud-texttospeech==1.0.1) and it also fails.我使用相同的库(google-cloud-texttospeech==1.0.1)尝试了您的示例,但它也失败了。 The fix for this is to just simply update your library to the latest version (2.3.0) using !pip install --upgrade google-cloud-texttospeech and your code snippet will work.解决此问题的方法是只需使用!pip install --upgrade google-cloud-texttospeech将您的库更新到最新版本(2.3.0),您的代码片段就会起作用。

Error when using the outdated 1.0.1 version.使用过时的 1.0.1 版本时出错。

在此处输入图像描述

For testing purposes I included printing of the encoded response.出于测试目的,我包括打印编码响应。 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:模块“google.cloud.bigquery_storage”没有属性“BigQueryReadClient” - Error: module 'google.cloud.bigquery_storage' has no attribute 'BigQueryReadClient' 模块 google.cloud 没有属性 storage - module google.cloud has no attribute storage 谷歌云文本语音仅适用于列表中的第一个字符串 - Google cloud texttospeech only works on first string in a list AttributeError:模块“ google.cloud.vision”没有属性“ Client” - AttributeError: module 'google.cloud.vision' has no attribute 'Client' Google Cloud Datastore“ NoneType”对象没有属性“ email” - Google Cloud Datastore 'NoneType' object has no attribute 'email' “google.cloud.storage”问题。 模块没有属性“客户端” - Issue with 'google.cloud.storage'. module has no attribute 'Client' 如何修复 Google Cloud ssh“模块‘时间’没有属性‘时钟’”? - How to fix Google Cloud ssh "module 'time' has no attribute 'clock'"? AttributeError:模块“google.cloud.vision”没有属性“类型” - AttributeError: module 'google.cloud.vision' has no attribute 'types' Google云端数据流-WriteToBigQuery:“ NoneType”对象没有属性“ __getitem__” - Google Cloud Dataflow - WriteToBigQuery: 'NoneType' object has no attribute '__getitem__' AttributeError: 模块 &#39;google.cloud&#39; 没有属性 &#39;storage&#39; - AttributeError: module 'google.cloud' has no attribute 'storage'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM