如何将 python 库添加到 Alexa 的 AWS lambda 函数中? [英] How do I add python libraries to an AWS lambda function for Alexa?

查看:22
本文介绍了如何将 python 库添加到 Alexa 的 AWS lambda 函数中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照教程使用 Python 创建了一个 Alexa 应用程序:

其他解决方案,例如 python-lambdalambda-uploader 有助于简化上传过程和最重要的本地测试.这些将节省大量开发时间.

I was following the tutorial to create an Alexa app using Python:

Python Alexa Tutorial

I was able to successfully follow all the steps and get the app to work.I now want to modify the python code and use external libraries such as import requests or any other libraries that I install using pip. How would I setup my lambda function to include any pip packages that I install locally on my machine?

解决方案

As it is described in the Amazon official documentation link here It is as simple as just creating a zip of all the folder contents after installing the required packages in your folder where you have your python lambda code.

As Vineeth pointed above in his comment, The very first step in moving from an inline code editor to a zip file upload approach is to change your lambda function handler name under configuration settings to include the python script file name that holds the lambda handler.

lambda_handler => {your-python-script-file-name}.lambda_handler.

Other solutions like python-lambda and lambda-uploader help with simplifying the process of uploading and the most importantly LOCAL TESTING. These will save a lot of time in development.

这篇关于如何将 python 库添加到 Alexa 的 AWS lambda 函数中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆