本文介绍了aws-“无法导入模块'process':/var/task/numpy/core/multiarray.so:无效的ELF标头"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用aws lambda脚本与numpy模块一起运行时,我收到以下错误:

Using aws lambda I am receiving the following error when the script is run with the numpy module:

此问题是与numpy本身有关,还是与AWS Lambda上的numpy有关.什么是无效的ELF标头?

Is this problem related to numpy itself or numpy specifically on aws lambda. What is an invalid ELF header?

我相信这与本机代码执行有关,如该答案所述

I believe this is related to native code execution, as stated in this answer "invalid ELF header" when using the nodejs "ref" module on AWS Lambda

推荐答案

问题与在本地计算机体系结构上编译的multiarray.so文件有关.启动一个ec2实例,并创建具有必要依赖项的virtualenv.这将使它以Aws lambda使用的正确体系结构进行编译.然后从ec2实例下载您的virtualenv并将其用于lambda.

The problem has to do with the multiarray.so file which was complied on my local computer's architecture. Spin up an ec2 instance and create your virtualenv with the necessary dependencies. This will cause it to compile with the correct architecture as used by Aws lambda. Then download your virtualenv from the ec2 instance and use that for lambda.

这篇关于aws-“无法导入模块'process':/var/task/numpy/core/multiarray.so:无效的ELF标头"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 06:41
查看更多