AWS Lambda and python numpy module

前端 未结 5 1474
梦毁少年i
梦毁少年i 2021-01-07 08:57

I am trying to import a python deployment package in aws lambda. The python code uses numpy. I followed the deployment package instructions for virtual env but it still gave

5条回答
  •  情深已故
    2021-01-07 09:15

    Using Numpy is a real pain.

    Numpy needs to be properly compiled on the same OS as it runs. This means that you need to install/compile Numpy on an AMI image in order for it erun properly in Lambda.

    The easiest way to do this is to start a small EC2 instance and install it there. Then copy the compiled files (from /usr/lib/python/site-packages/numpy). These are the files you need to include in your Lambda package.

    I believe you can also use the serverless tool to achieve this.

提交回复
热议问题