[英]Bad:Can't finish “storage_client = storage.Client()” in google cloud speech
Thank you for helping me! When I use google cloud speech in Jupyter notebook, the error happened when I ran the following codes: 感谢您的帮助!当我在Jupyter笔记本中使用Google Cloud Speech时,运行以下代码时发生了错误:
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(os.path.realpath('.'),'Lu/Lu-xxxxxxxxxx.json')
os.path.join(os.path.realpath('.'),'Lu/Lu-xxxxxxxxxx.json')
with open("Lu/Lu-xxxxxxxxxx.json") as f:
GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
def transcribe_gcs(gcs_uri):
from google.cloud import speech
...
client = speech.SpeechClient()
audio = ...
config = ...
operation = client.long_running_recognize(config, audio)
...
response = operation.result(timeout=90)
...
# Imports the Google Cloud Storage client library
from google.cloud import storage
# Instantiates a client()
storage_client = storage.Client()
When reading the last line, it said DefaultCredentialsError:File /home/luffy/Lu/Lu-xxxxxxxxxx.json was not found.
读取最后一行时,它说DefaultCredentialsError:File /home/luffy/Lu/Lu-xxxxxxxxxx.json was not found.
But I'm sure the .json is there. 但是我确定.json在那里。 Is there some problems with my project authentication configuration? 我的项目身份验证配置是否存在一些问题?
When I look at these problems, I feel that I lack some bacic knowledge. 当我看这些问题时,我感到我缺乏一些基础知识。 I don't fully understand the relation between google cloud speech and python, etc. Where can learn them? 我不完全了解Google Cloud Speech和python等之间的关系。在哪里可以学习?
Thank you! 谢谢!
It turns out that It may be a configureation problem. 事实证明,这可能是配置问题。 I didn't finish well all the 'setting up environment' process for google cloud. 我对Google Cloud的所有“设置环境”过程都做得不好。 Fot this part quickstart for ubuntu and Debian , I changed the project to the project I'm working right now(I changed the my project on google cloud some time before, but didn't follow this website to change my project). 对于ubuntu和Debian的这部分快速入门 ,我将项目更改为我现在正在使用的项目(前一段时间,我在google cloud上更改了我的项目,但没有跟随该网站更改我的项目)。 The I set up 'virtualenv' environment for my local project folder. 我为本地项目文件夹设置了“ virtualenv”环境。 After these steps, I succeeded! 经过这些步骤,我成功了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.