简体   繁体   English

通过Cloud9在AWS Lambda中使用Python 3rd Party模块

[英]Python 3rd Party Modules in AWS Lambda through Cloud9

I had a quick question. 我有一个简短的问题。 I recently started to learn python and have been using Cloud9 as my environment. 我最近开始学习python,并一直使用Cloud9作为我的环境。 I've created a code for Alexa in python that uses BeautifulSoup, meaning that AWS Lambda throws an error every time I run it (as it does not recognize BeautifulSoup as a model). 我已在Python中使用BeautifulSoup创建了一个Alexa代码,这意味着AWS Lambda每次运行它都会引发错误(因为它无法将BeautifulSoup识别为模型)。 I was wondering, since I'm working in Cloud9, how do I allow/permit AWS Lambda to work with BeautifulSoup? 我想知道,因为我在Cloud9中工作,我如何允许/允许AWS Lambda与BeautifulSoup一起使用?

To actually install the BS library, you'll need to use Pip . 要实际安装BS库,您需要使用Pip That will get it working in Cloud9. 这将使其在Cloud9中工作。 When you use the function in Lambda, it will require a deployment package that also includes the BS library. 当您在Lambda中使用该功能时,它将需要一个包含BS库的部署程序包

The error you are getting probably relates to the library not existing in the Lambda environment. 您遇到的错误可能与Lambda环境中不存在的库有关。

If Cloud9 doesn't make it easy to export a deployment package, you might have to upload code manually . 如果Cloud9不能轻松导出部署程序包,则可能必须手动上传代码

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

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