[英]Does Amazon Web Services (AWS) Lambda support all Python libraries?
For example, I would like to use scikit-learn for machine learning, and pandas, numpy, and matplotlib/seaborn for data analysis.例如,我想使用 scikit-learn 进行机器学习,使用 pandas、numpy 和 matplotlib/seaborn 进行数据分析。 Does AWS Lambda support all these libraries? AWS Lambda 是否支持所有这些库? Is there a list of libraries supported?是否有支持的库列表? Or should I create a virtual server instead, to ensure I can use any Python library I want?或者我应该创建一个虚拟服务器,以确保我可以使用我想要的任何 Python 库?
Those modules are not available by default.默认情况下,这些模块不可用。 I found this (older) list of available modules, along with code to generate a current report of what is available, should you wish to do so:我发现了这个(旧的)可用模块列表,以及生成可用模块的当前报告的代码,如果你愿意的话:
https://gist.github.com/sjehutch/36493ff674b1b9a16fc44a5fc270760c https://gist.github.com/sjehutch/36493ff674b1b9a16fc44a5fc270760c
You can build your own environment using a virtualenv and upload that to Lambda.您可以使用 virtualenv 构建自己的环境并将其上传到 Lambda。 It can contain anything you want.它可以包含您想要的任何内容。 See here for more info:请参阅此处了解更多信息:
https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
So you can still use AWS Lambda, and should not require a virtual server.因此您仍然可以使用 AWS Lambda,并且不需要虚拟服务器。
Edited to add a bit of self promotion:编辑添加了一些自我宣传:
I made a web site that shows the current modules available in each environment provided by Amazon.我制作了一个网站,展示了 Amazon 提供的每个环境中可用的当前模块。
In addition to the default Python Standard Library, some third-party packages are embedded in AWS Lambda Python runtimes.除了默认的 Python 标准库之外,AWS Lambda Python 运行时中还嵌入了一些第三方包。 These packages are ready to be used in your FaaS functions.这些包已准备好在您的 FaaS 功能中使用。
A daily-updated list of supported packages can be found here.可在此处找到每日更新的受支持软件包列表。
https://www.feitsui.com/en/article/2 https://www.feitsui.com/en/article/2
I've built a small library called juniper to automate the packaging of code for AWS lambda functions.我构建了一个名为juniper的小型库来自动打包 AWS lambda 函数的代码。
All you need to do to use juniper is create a small manifest.yml
file that looks like:使用 juniper 所需要做的就是创建一个小的manifest.yml
文件,如下所示:
functions:
# Name the zip file you want juni to create
router:
# Where are your dependencies located?
requirements: ./src/requirements.txt.
# Your source code.
include:
- ./src/lambda_function.py
As long as you have your dependencies in the requirements.txt, juniper will package them for you.只要您在 requirements.txt 中有您的依赖项,juniper 就会为您打包它们。 There are a few examples in our code base that showcase the features of juniper.我们的代码库中有一些示例展示了瞻博网络的功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.