python中的AWS Lambda导入模块错误
我正在创建一个AWS Lambda python部署程序包。我正在使用一个外部依赖项请求。我使用AWS文档http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html安装了外部依赖项。以下是我的python代码。 import requests print('Loading function') s3 = boto3.client('s3') def lambda_handler(event, context): #print("Received event: " + json.dumps(event, indent=2)) # Get the object from the event and show its content type bucket = event['Records'][0]['s3']['bucket']['name'] key = urllib.unquote_plus(event['Records'][0]['s3']['object']['key']).decode('utf8') try: response = s3.get_object(Bucket=bucket, Key=key) s3.download_file(bucket,key, '/tmp/data.txt') lines = [line.rstrip('\n') for line in …