Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Google cloud texttospeech“;没有属性';综合输入'&引用;错误_Python_Google Cloud Platform_Google Text To Speech - Fatal编程技术网

Python Google cloud texttospeech“;没有属性';综合输入'&引用;错误

Python Google cloud texttospeech“;没有属性';综合输入'&引用;错误,python,google-cloud-platform,google-text-to-speech,Python,Google Cloud Platform,Google Text To Speech,在尝试Google的主要示例时,我遇到了以下错误: AttributeError Traceback (most recent call last) <ipython-input-92-866a7868dbb4> in <module> 10 11 # Set the text input to be synthesized ---> 12 synthesis_input = texttos

在尝试Google的主要示例时,我遇到了以下错误:

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'
AttributeError回溯(最近一次调用)
在里面
10
11#设置要合成的文本输入
--->12合成输入=texttospeech.SynthesisInput(text=“你好,世界!”)
13
14#构建语音请求,选择语言代码(“en-US”)和ssml
AttributeError:模块“google.cloud.texttospeech”没有属性“SynthesisInput”
有什么建议吗?
使用conda forge:google cloud texttospeech 1.0.1

我使用相同的库(google cloud texttospeech==1.0.1)尝试了您的示例,但也失败了。解决方法是只需使用
将库更新到最新版本(2.3.0)!pip安装——升级google cloud texttospeech
,您的代码片段将正常工作

使用过时的1.0.1版本时出错

出于测试目的,我包括打印编码响应。

你有时间检查我的答案吗?它帮助你解决了你的问题?如果是,请考虑接受并投票表决。