【发布时间】:2020-08-13 17:55:36
【问题描述】:
我只是想在我的 Python 3.8 Lambda 中使用 PIL。
我正在尝试以下步骤:
cd /mydir
git clone https://github.com/hidekuma/lambda-layers-for-python-runtime.git
cd lambda-layers-for-python-runtime
mkdir dist
docker-compose up --build
aws lambda publish-layer-version --layer-name ImageStorageDependencies
--description "A Python 3.8 runtime with PIL and boto3 installed." --license-info "MIT" --zip-file fileb://output.zip --compatible-runtimes python3.7 python3.8 --region us-east-2
然后我在 Lamda 配置中选择我的层,但是当我运行此代码时:
import json
import boto3
import io
from PIL import Image
def lambda_handler(event, context):
#etc
...我收到错误:
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': cannot import name '_imaging' from 'PIL'
我到底哪里错了?!?
【问题讨论】:
标签: python aws-lambda aws-lambda-layers