如何将要安装的python软件包(使用apt-get)放置在GCP应用程序引擎的requirements.txt中 [英] How to place the python packages to be install (using apt-get) in requirements.txt in GCP app engine
问题描述
我正在尝试在GCP App引擎中运行我的应用程序.我的Requirements.txt文件如下所示:
I am trying to run my app in GCP App engine. My Requirements.txt file looks like below:
pillow==5.1.0
pybase64==0.4.0
poppler-utils==0.68.0
只能在GCP命令行工具中使用sudo apt-get安装Poppler-utils.我如何在requirements.txt中提供它,以便应用程序使用sudo apt-get命令单独安装该软件包?
Poppler-utils can be installed only using sudo apt-get in GCP command line tool. How can I give it in requirements.txt so that the app installs that package alone using sudo apt-get command ?
推荐答案
Requirements.txt文件特定于pip,并且只能包含Python包.
The requirements.txt file is specific to pip and can only include Python packages.
如果您需要安装操作系统级别的软件包(带有apt-get),则需要使用基于Docker的App Engine Flexible环境(Standard不提供此功能)并创建
If you need to install an OS-level package (with apt-get), you'll need to use the Docker based App Engine Flexible environment (Standard doesn't provide this functionality) and create a custom runtime.
您可以在此处扩展默认的python图像:
You can find a Dockerfile example here extending the default python image:
FROM gcr.io/google-appengine/python
然后,您需要通过以下方式添加poppler-utils
包:
You'll then need to add the poppler-utils
package via:
RUN apt-get install poppler-utils
您将找到有关为App Engine Flexible构建自定义运行时的更多信息这里.
You'll find more information about building custom runtimes for App Engine Flexible here.
这篇关于如何将要安装的python软件包(使用apt-get)放置在GCP应用程序引擎的requirements.txt中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!