Python 如何在requirements.txt中为Google云函数导入speech_v1
我基本上是将其用作Google Cloud函数的Python代码: 我无法在Python 如何在requirements.txt中为Google云函数导入speech_v1,python,google-cloud-platform,google-cloud-functions,Python,Google Cloud Platform,Google Cloud Functions,我基本上是将其用作Google Cloud函数的Python代码: 我无法在requirements.txt文件中正确导入speech\u v1库 我得到了这个错误: Build失败:{“error”:{“canonicalCode”:“INVALID_ARGUMENT”,“errorMessage”:“pip_download_wheels有stderr输出:\n错误:找不到满足要求的版本google-cloud-speech-v1==1.3.2(来自-r requirements.txt(
requirements.txt
文件中正确导入speech\u v1
库
我得到了这个错误:
Build失败:{“error”:{“canonicalCode”:“INVALID_ARGUMENT”,“errorMessage”:“pip_download_wheels有stderr输出:\n错误:找不到满足要求的版本google-cloud-speech-v1==1.3.2(来自-r requirements.txt(第3行))(来自版本:无)\错误:找不到与google-cloud-speech-v1==1.3.2(来自-r requirements.txt(第3行))\n\n错误:
pip\u下载\u车轮返回的代码:1”,“errorType:“InternalError”,“errorId:”}
尝试在您的需求中使用
googlecloudspeech==1.3.2
。在您的requirements.txt
中,您应该指定:
google-cloud-speech==1.3.2
其中名称和版本与PyPI上的此版本相对应:
这允许您执行以下任一操作:
from google.cloud import speech
from google.cloud import speech_v1
其中,
speech
始终是最新版本,speech\u v1
确保您始终使用API的v1。在requirements.txt中指定google cloud speech
。这仍然会给我错误,因为speech\u v1未定义。显示生成错误的代码。你猜语音v1是未定义的吗?