from google.cloud import translate client = translate.Client() result = client.translate(u'I am a programer', target_language='ja') print(result['translatedText'])
https://gb-j.com/column/translate/
上記urlに記載されている方法でcloud Translation APIを設定し実行しましたが、
エラー:
「File "translate2.py", line 1, in <module>
from google.cloud import translate
ImportError: No module named google.cloud」
が出ました。
以下済みです。
・Cloud Translate API の有効化
・サービスアカウントキーの取得
・サービスアカウントキーの適用(export GOOGLE_APPLICATION_CREDENTIALS="ダウンロードjsonファイルパス"のターミナルへの記載)
・cloud sdkのインストール
以上、解決したいです。
また、解決策として他のAPIで試そうと思っています。
ご教示いただけましたら助かります。
宜しくお願い致します。
あなたの回答
tips
プレビュー