问题描述
我正在处理这篇文章 Asynchronous Amazon Transcribe Streaming SDK for Python。
我正在尝试为所需的库创建一个 lambda 层。
我使用了以下命令:
pip3 install amazon-transcribe aiofile -t .
但是当我在我的 lambda 函数中使用该层时出现以下错误:
Unable to import module 'lambda_function': No module named '_awscrt'
同样适用于本地虚拟环境。我不确定确切的问题是什么。
我什至尝试单独安装 awscrt,但没有成功。
任何形式的帮助将不胜感激。谢谢!
解决方法
Lambda 层 .zip 文件需要遵循特定的目录文件结构。查看 documentation 的这一部分,了解它应该如何为 Python 构建。这可能是您的问题。
,我在 Amazon Linux 上构建了该层,并且运行良好!
存储库中的 troubleshooting guide 帮助了:
caio linux 实现对于现代 linux 内核版本和文件系统正常工作。因此,您可能会遇到特定于您的环境的问题。这不是错误,可能会通过某些方式解决:
1. Upgrade the kernel
2. Use compatible file system
3. Use threads based or pure python implementation.