When importing matplotlib. I get the error: No module named 'numpy.core._multiarray_umath'
When importing matplotlib. I get the error: No module named 'numpy.core._multiarray_umath'
我在我的 python 项目中使用 matplotlib 库,而该项目又使用 numpy。我已经在 AWS Lambda 层中部署了这些库,并将它们导入到我的 AWS lambda 函数中。当我测试我的 AWS Lambda 函数时,它抛出以下错误:
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.8 from "/var/lang/bin/python3.8" * The NumPy version is: "1.18.5" Original error was: No module named 'numpy.core._multiarray_umath'
知道可能的原因是什么以及如何解决吗?
我正在回答这个问题,以便将来如果有人也遇到这个问题,那么下面的解决方案也可能适用于他们。
问题是我在 windows 10 环境中编译了所需的程序包,然后将它们部署在供 AWS Lambda 函数使用的层上。 AWS Lambda 函数和 Layers 在中使用 Linux
背景所以在 Windows 环境中编译的包与 AWS Lambda 函数不兼容。当我在 Linux 环境中再次编译所需的包并将它们部署在层上并再次通过 lambda 函数使用它们时,它就像一个魅力!
This Medium 文章帮助我解决了我的问题。
我在我的 python 项目中使用 matplotlib 库,而该项目又使用 numpy。我已经在 AWS Lambda 层中部署了这些库,并将它们导入到我的 AWS lambda 函数中。当我测试我的 AWS Lambda 函数时,它抛出以下错误:
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.8 from "/var/lang/bin/python3.8" * The NumPy version is: "1.18.5" Original error was: No module named 'numpy.core._multiarray_umath'
知道可能的原因是什么以及如何解决吗?
我正在回答这个问题,以便将来如果有人也遇到这个问题,那么下面的解决方案也可能适用于他们。
问题是我在 windows 10 环境中编译了所需的程序包,然后将它们部署在供 AWS Lambda 函数使用的层上。 AWS Lambda 函数和 Layers 在中使用 Linux 背景所以在 Windows 环境中编译的包与 AWS Lambda 函数不兼容。当我在 Linux 环境中再次编译所需的包并将它们部署在层上并再次通过 lambda 函数使用它们时,它就像一个魅力!
This Medium 文章帮助我解决了我的问题。