简体   繁体   English

打包没有requirements.txt的python lambda python文件的方法

[英]way to package python lambda python files with no requirements.txt

Is there a way to package lambda files that do not have requirements.txt?有没有办法打包没有requirements.txt的lambda文件? For using docker or other methods we need to have requirements.txt.要使用 docker 或其他方法,我们需要有 requirements.txt。 Please share ur opinions !请分享您的意见!

Yes, at a minimum you just need to zip the code.是的,至少您只需要压缩代码即可。 If the handler function is in a file named my_lambda.py, then your zip needs to have this file at the root.如果处理程序函数位于名为 my_lambda.py 的文件中,则您的 zip 需要在根目录中包含此文件。 If your code has 3rd-party dependencies, you must add them to the zip yourself--they won't get automatically installed by Lambda.如果您的代码具有第 3 方依赖项,您必须自己将它们添加到 zip 中——它们不会被 Lambda 自动安装。

Check out查看

Also, you may want to consider using Lambda Layers: https://medium.com/@adhorn/getting-started-with-aws-lambda-layers-for-python-6e10b1f9a5d此外,您可能需要考虑使用 Lambda 层: https : //medium.com/@adhorn/getting-started-with-aws-lambda-layers-for-python-6e10b1f9a5d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM