Numpy 使用无服务器python需求为无服务器编译python本机库
我正试图从我的windows机器上编译numpy以用于AWS Lambda函数 我一直在遵循lambda打印numpy数组的无服务器python要求的简单示例 我在本地目录下的virtualenv中运行无服务器部署../numpy测试 我的requirements.txt文件只包含Numpy 使用无服务器python需求为无服务器编译python本机库,numpy,docker,python-3.6,serverless-framework,aws-serverless,Numpy,Docker,Python 3.6,Serverless Framework,Aws Serverless,我正试图从我的windows机器上编译numpy以用于AWS Lambda函数 我一直在遵循lambda打印numpy数组的无服务器python要求的简单示例 我在本地目录下的virtualenv中运行无服务器部署../numpy测试 我的requirements.txt文件只包含 numpy==1.13.1 我的YML文件如下所示: service: numpy-test frameworkVersion: ">=1.1.0 <2.0.0" plugins: - ser
numpy==1.13.1
我的YML文件如下所示:
service: numpy-test
frameworkVersion: ">=1.1.0 <2.0.0"
plugins:
- serverless-domain-manager
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip:non-linux
stage: ${opt:stage, self:provider.stage}
domains:
prod: ...
staging: ...
dev: ...
当我直接从AWS lambda下载依赖项时,看起来该包是在windows中编译的
我已经安装了Docker,据我所知,它工作正常。我以前从未使用过它,所以这就是为什么我尝试使用这个解决方案,而不是在Docker中学习许多新命令
出了什么问题?我不确定您的情况到底发生了什么,但是如果您想在Lambda中使用numpy,请查看numpy和scipy 要使用它,请在serverless.yml中的函数中添加一个
functions:
myFunction:
layers:
- arn:aws:lambda:us-east-1:668099181075:layer:AWSLambda-Python36-SciPy1x:2
您可能需要根据所针对的AWS地区更改ARN。我将对此进行调查。我试图解决任意依赖项的本机编译的一般情况,因此我不能像最简单的示例中那样使用预构建层,但非常像lambda层的思想。只需要弄清楚如何在与aws兼容的容器xD中成功编译依赖项
"errorMessage": "Unable to import module 'handler'"
}
--------------------------------------------------------------------
START RequestId: 24584f5c-5145-4694-b21b-7c6e4700f985 Version: $LATEST
Unable to import module 'handler':
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: cannot import name 'multiarray'
functions:
myFunction:
layers:
- arn:aws:lambda:us-east-1:668099181075:layer:AWSLambda-Python36-SciPy1x:2