简体   繁体   English

无法导入模块“lambda_function”:没有名为“_speech_py_impl”的模块

[英]Unable to import module 'lambda_function': No module named '_speech_py_impl'

Using an AWS Lambda function to use some of Microsoft Azure TTS API.使用 AWS Lambda 函数来使用一些 Microsoft Azure TTS API。 Having trouble and getting error just trying to import "import azure.cognitiveservices.speech as speechsdk".尝试导入“import azure.cognitiveservices.speech as speechsdk”时遇到问题并出错。 Uploaded needed dependency correctly with pip3 install azure-cognitiveservices-speech -t .使用 pip3 install azure-cognitiveservices-speech -t 正确上传了所需的依赖项。

Seems to be a problem with AWS runtime being linux, works fine locally on mac machine.似乎是 AWS 运行时是 linux 的问题,在 mac 机器上本地运行良好。 Could anyone help?有人可以帮忙吗? Might have to do with uploading a custom docker image like this solution or some sort of problem with this , but not sure how to add this dependency to aws lambda.可能与上传自定义 docker 映像有关,例如此解决方案或此解决方案的某种问题,但不确定如何将此依赖项添加到 aws lambda。

Thanks a bunch.谢谢一堆。

To resolve this Unable to import module 'lambda_function': No module named '_speech_py_impl' error, try following way:要解决此Unable to import module 'lambda_function': No module named '_speech_py_impl'错误,请尝试以下方法:

You might have installed azure-cognitiveservices-speech in the wrong directory.您可能在错误的目录中安装了azure-cognitiveservices-speech

According to documentation :根据文件

1. Open AWS EC2 environment: 1 、开启AWS EC2环境:

$ sudo amazon-linux-extras install python3.8
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ python3.8 get-pip.py --user

2. Create Python folder: 2.创建 Python 文件夹:

$ mkdir python

3. Install azure.cognitiveservices.speech : 3.安装azure.cognitiveservices.speech

$ python3.8 -m pip install azure.cognitiveservices.speech -t python/

4. Zip the contents: 4.压缩内容:

$ zip -r layer.zip python

5. Publish the Lambda layer with the AWS region where your Lambda function is located: 5.使用您的 Lambda 函数所在的 AWS 区域发布 Lambda 层:

aws lambda publish-layer-version --layer-name azure.cognitiveservices.speech-layer --zip-file fileb://layer.zip --compatible-runtimes python3.8 --region <your AWS region>

References: Unable to import module 'lambda_function' , AWS Lambda Python error - Runtime.ImportModuleError and ModuleNotFoundError: No module named '_speech_py_impl'参考: 无法导入模块“lambda_function”AWS Lambda Python 错误 - Runtime.ImportModuleErrorModuleNotFoundError:没有名为“_speech_py_impl”的模块

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS Lambda 错误消息“无法导入模块'lambda_function':没有名为'lambda_function'的模块”, - AWS Lambda error message “Unable to import module 'lambda_function': No module named 'lambda_function'”, 无法导入模块“lambda_function”:没有名为 * 的模块 - Unable to import module 'lambda_function': No module named * 无法导入模块“ lambda_function”:没有名为“ error”的模块 - Unable to import module 'lambda_function': No module named 'error' 无法导入模块“lambda_function”:没有名为 xlrd 的模块 - Unable to import module 'lambda_function': No module named xlrd 无法导入模块“ lambda_function”:没有名为“ mysql”的模块 - Unable to import module 'lambda_function': No module named 'mysql' 无法导入模块&#39;lambda_function&#39;:没有名为&#39;stomp&#39;的模块 - Unable to import module 'lambda_function': No module named 'stomp' AWS SAM Local和docker-lambda:继续无法导入模块'lambda_function':没有名为'lambda_function'的模块 - AWS SAM Local and docker-lambda: keep getting Unable to import module 'lambda_function': No module named 'lambda_function' 无法导入模块“lambda_function”:没有名为“psycopg2._psycopg aws lambda 函数”的模块 - Unable to import module 'lambda_function': No module named 'psycopg2._psycopg aws lambda function AWS Lambda 层无法导入模块“lambda_function”:没有名为“pyarrow.lib”的模块 - AWS Lambda Layer Unable to import module 'lambda_function': No module named 'pyarrow.lib' AWS Lambda:无法导入模块“ lambda_function”:没有名为boto.ec2.autoscale的模块 - AWS Lambda: Unable to import module 'lambda_function': No module named boto.ec2.autoscale
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM