Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 坏的:;Can';“t完成”;存储客户机=storage.client();在谷歌云演讲中_Python_Ubuntu_Jupyter Notebook_Google Cloud Speech - Fatal编程技术网

Python 坏的:;Can';“t完成”;存储客户机=storage.client();在谷歌云演讲中

Python 坏的:;Can';“t完成”;存储客户机=storage.client();在谷歌云演讲中,python,ubuntu,jupyter-notebook,google-cloud-speech,Python,Ubuntu,Jupyter Notebook,Google Cloud Speech,谢谢你帮助我 当我在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("

谢谢你帮助我 当我在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()
阅读最后一行时,它说
DefaultCredentialsError:File/home/luffy/Lu/Lu-xxxxxxxxx.json未找到。

但我确信.json就在那里。我的项目身份验证配置是否存在一些问题

当我看到这些问题时,我觉得我缺乏一些基础知识。我不完全理解谷歌云语音和python等的关系,在哪里可以学习它们


谢谢大家!

这可能是一个配置问题。我没有很好地完成谷歌云的所有“设置环境”过程。在这一部分中,我将项目更改为我现在正在工作的项目(之前我在google cloud上更改了我的项目,但没有按照此网站更改我的项目)。我为本地项目文件夹设置了“virtualenv”环境。经过这些步骤,我成功了

在将错误消息中的文件路径复制粘贴到shell中之前,您什么都不确定,就在
stat
:)之后。我建议用一个简短、合理的名称命名该文件。谢谢!我试过了,我可以
stat
文件。如果我有一个很长很复杂的名字会发生什么?我已经试着运行你提供的代码段,但没有遇到这个错误。错误消息表明在那里找不到该文件。我可以要求您在Jupyter之外运行这个脚本,只需在命令行中运行,或者您也可以使用cloudshell吗?如果知道显示的错误是否相同,这将是有益的。您是否也可以发布完整的回溯,以便更清楚地了解源代码中是什么导致了此错误?谢谢Philipp!我已经解决了这些问题。结果是一些环境问题,我没有注意到;在建立googld云的过程中无法解决问题!谢谢大家!@鲁煌,我可以请你把你所做的作为一个回答,然后,接受它吗?我看到了Jupyter笔记本和GCP的其他问题,因此,社区未来的任何参考资料都会很好