【问题标题】:External Python Libraries Not Detected by AWS Lambda FunctionsAWS Lambda 函数未检测到外部 Python 库
【发布时间】:2021-12-07 01:01:33
【问题描述】:

我正在尝试在 AWS 上的 lambda 函数中使用 PyMuPDF。

我已使用此 youtube 视频尝试将库集成为一个层,以便它可以在我的 lambda 函数上运行。 How to install Pandas on AWS Lambda function(简而言之:压缩 linux 库包,然后将其保存一层,然后将该层应用于您的函数)

我从PyPI 获得了库,并尝试使用最新和旧版本,它们都不起作用。

ZIP 文件包含从 PyPI 解压缩的这两个文件夹

Python_library.zip
│ python_library/PyMuPDF
└ python_library/PyMuPDF-1.18.10.dist-info

有谁知道我做错了什么?一些帮助将不胜感激!

【问题讨论】:

  • 哇,你让我的问题的解决方案变得如此简单。感谢您提出这个问题。如果我能一次又一次地投票,我会的。

标签: python-3.x aws-lambda libraries


【解决方案1】:

请检查 zip 中的文件夹是 python 而不是 python_library

aws-doc:

The following examples show how you can structure the folders in your layer .zip archive.

pillow.zip
│ python/PIL
└ python/Pillow-5.3.0.dist-info

这对我有用:

  • Python3.7
python.zip
└── python/
    ├── fitz/
    └── PyMuPDF-1.19.0.dist-info/

【讨论】:

  • 谢谢。不错的简单解决方案。
猜你喜欢
  • 2018-07-11
  • 2017-12-24
  • 2018-09-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-16
  • 2020-09-14
  • 1970-01-01
相关资源
最近更新 更多