簡體   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

在嘗試主要的谷歌示例時,我收到了這個錯誤:

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'

有什么建議嗎? 使用 conda-forge:google-cloud-texttospeech 1.0.1

我使用相同的庫(google-cloud-texttospeech==1.0.1)嘗試了您的示例,但它也失敗了。 解決此問題的方法是只需使用!pip install --upgrade google-cloud-texttospeech將您的庫更新到最新版本(2.3.0),您的代碼片段就會起作用。

使用過時的 1.0.1 版本時出錯。

在此處輸入圖像描述

出於測試目的,我包括打印編碼響應。 在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM