如何在 GCP 应用程序引擎的 requirements.txt 中放置要安装的 python 包(使用 apt-get)

How to place the python packages to be install (using apt-get) in requirements.txt in GCP app engine

我正在尝试 运行 我的应用程序在 GCP App Engine 中。我的 Requirements.txt 文件如下所示:

pillow==5.1.0
pybase64==0.4.0
poppler-utils==0.68.0 

Poppler-utils 只能使用 GCP 命令行工具中的 sudo apt-get 安装。我如何在 requirements.txt 中提供它,以便应用程序使用 sudo apt-get 命令单独安装该软件包?

requirements.txt 文件特定于 pip,只能包含 Python 个包。

如果您需要安装 OS 级别的包(使用 apt-get),您将需要使用基于 Docker 的 App Engine 灵活环境(标准版不提供此功能)功能)并创建一个 custom runtime.

您可以找到扩展默认 python 图像的 Docker 文件示例 here

FROM gcr.io/google-appengine/python

然后您需要通过以下方式添加 poppler-utils 包:

RUN apt-get install poppler-utils

您将找到有关为 App Engine Flexible here 构建自定义运行时的更多信息。