首页 > 解决方案 > googletrans JSONDecodeError 在翻译时

问题描述

我正在使用以下命令安装 Google Trans:

pip install google_trans_new

然后:

import googletrans
from google_trans_new import google_translator


translator = google_translator()  
translate_text = translator.translate('hola',lang_tgt='en')  
print(translate_text)

但我得到这个错误:

 "JSONDecodeError Traceback (most recent call last)
<ipython-input-17-92dfe7fca89f> in <module>()"

我也尝试像这个例子一样在谷歌合作中使用它并得到同样的错误。 https://towardsdatascience.com/google-translate-api-for-python-723093c2144b

标签: python

解决方案


推荐阅读