无法为AWS Lambda导入grequest [英] Unable to import grequests for AWS Lambda
问题描述
我正在运行带有Python 2.7
运行时的AWS Lambda脚本.但是,无论何时初始化,它都会开始导入grequests
库,但是由于依赖于gevent而失败:
Gevent is required for grequests.
似乎可以成功找到grequests库(因为它知道需要gevent),但是失败了.
到目前为止我已经尝试过的:
pip install --ignore-installed grequests -t .
pip install --ignore-installed grequests -t ./lib
pip install --ignore-installed gevent -t .
pip install --ignore-installed gevent -t ./lib
然后,我压缩目录的内容并按照此处的说明上载到AWS:解决方案
我必须在Amazon Linux实例上从src
构建gevent
.如果有人需要,我会将结果文件放在zip
中-只需将它们包含在上载的Lambda zip
中,您就应该像老板一样并发操作.
https://github.com/brandonmp/aws-lambda-grequests
I'm running an AWS Lambda script with a Python 2.7
runtime. However, whenever it initializes it begins to import the grequests
library but fails because of it's dependency on gevent:
Gevent is required for grequests.
It seems it is successfully finding the grequests library (since it knows it needs gevent) but fails.
What I've tried so far:
pip install --ignore-installed grequests -t .
pip install --ignore-installed grequests -t ./lib
pip install --ignore-installed gevent -t .
pip install --ignore-installed gevent -t ./lib
And then I compress the contents of the directory and upload to AWS per the instructions here: http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
It seems no matter what I try the Lambda is unable to locate gevent
, but it's able to find other non-default libraries with no issue.
I had to build gevent
from src
on an Amazon Linux instance. I put the resultant files in a zip
if anyone needs them--just include them in your uploaded Lambda zip
and you should be concurrent-ing like a boss.
https://github.com/brandonmp/aws-lambda-grequests
这篇关于无法为AWS Lambda导入grequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!