简体   繁体   English

错误:无法在Google云语音中完成“ storage_client = storage.Client()”

[英]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.

相关问题 无法在Google Cloud Speech中完成“ client = speech.SpeechClient()” - Can't finish “client = speech.SpeechClient()” in Google Cloud Speech Python Mocking - 如何模拟 Google 的 storage.client? - Python Mocking - How to mock Google's storage.client? Google storage.Client 抛出 .__int__ 错误:接受 2 个位置参数,但给出了 3 个 - Google storage.Client throwing .__int__ error: takes 2 positional arguments but 3 were given Google App Engine云存储客户端无法安装 - Google App Engine Cloud Storage Client won't Install 使用Google Cloud Storage python客户端进行批量请求 - Batch request with Google Cloud Storage python client Flask:无法验证 Google Cloud Storage 客户端 - Flask: Could not authenticate the Google Cloud Storage client 适用于Google云端存储和大文件的Python客户端 - Python Client for Google Cloud Storage and large files 本地客户端上带有远程 api 的 Google 云存储客户端 - Google cloud storage client with remote api on local client 使用 google-cloud-storage Python 客户端获取下载标头? - Get download headers with google-cloud-storage Python client? Google Cloud Storage - Python 客户端 - 获取 Blob 的链接 URL - Google Cloud Storage - Python Client - Get Link URL of a blob
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM