lambda 函数中的 NumPy 设置/导入问题

NumPy setup / import issue in lambda function

运行时 python 3.7 兼容运行时 3.7

尝试在 lambda 函数中测试 API 时,我不断收到导入错误

PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n    https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n  * The Python version is: Python3.7 from \"/var/lang/bin/python3.7\"\n  * The NumPy version is: \"1.21.5\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: No module named 'numpy.core._multiarray_umath'\n",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []

我已经尝试在 docker 中添加 numpy pip install,但问题仍然存在...

使用的dockfile引擎是amazonlinux:2

有什么方法可以解决这个奇怪的问题吗?

根据评论。

解决方案是使用 Numpy 层 provided by AWS