简体   繁体   English

如何在Google Cloud Platform中为Node应用程序安装Python3

[英]How to install Python3 in Google Cloud Platform for a Node app

I'm using google cloud platform for my nodejs app. 我正在使用谷歌云平台为我的nodejs应用程序。 Problem, after deploying the app i have access to python2.7 but not to the version 3. This one seems to be missing in the usr/bin folder. 问题,在部署应用程序后,我可以访问python2.7但不能访问版本3.这个似乎在usr / bin文件夹中缺失。

const spawn = require("child_process").spawn;
spawn('python'); // working
spawn('/usr/bin/python3'); // not working
spawn('python3'); // not working 

Error: spawn python3 ENOENT

I used fs module to display the usr/bin folder : 我用fs模块显示usr / bin文件夹:

...
pygettext2.7
python
python2
python2.7
pyversions
...

Any idea how can I install python3 during the deployment of the app ? 任何想法如何在部署应用程序期间安装python3? Maybe changing the app.yaml file ? 也许更改app.yaml文件?

Thank you 谢谢

If you need a runtime that has both a specific version of Node.js and Python, you'd probably be better off using Cloud Run and specifying a custom image instead of trying to use one language inside another's runtime. 如果您需要一个同时具有特定版本的Node.js和Python的运行时,您可能最好使用Cloud Run并指定自定义映像,而不是尝试在另一个运行时内使用一种语言。

Flex would also possibly work here, but Cloud Run will likely be significantly cheaper, have faster startup times, and can scale to zero. Flex也可能在这里工作,但Cloud Run可能会更便宜,启动时间更短,并且可以扩展到零。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Google App Engine for Python3 上安装库 - How to install libraries on Google App Engine for Python3 python3上的打印语句不再登录谷歌云平台 - Print statements on python3 no longer logging on Google Cloud Platform 如何在Google Cloud Platform中安装Google AI Platform中的Spark依赖 - How to install Spark dependencies in Google AI Platform in Google Cloud Platform Google Cloud App Engine的最佳做法:Python2或Python3? - Best practices with google cloud app engine: Python2 or Python3? 如何在python3标准应用引擎项目中访问谷歌云库? - How to access Google cloud library in python3 standard app engine project? 我可以在Google Cloud Platform的Python应用程序中运行Webpack吗? - Can I run Webpack in a Python app on Google Cloud Platform? 谷歌云平台 SQL 实例连接到 python 应用程序 - Google Cloud Platform SQL instance connection to python app 如何构建 docker 以从 Google App Engine 中的 Node.js child_process 运行 Python3? - How to build docker to run Python3 from Node.js child_process in Google App Engine? 如何在 Google Cloud Platform、App Engine 中执行 pip install -r requirements.txt(不使用 Gitlab CI)? - How can I execute pip install -r requirements.txt inside Google Cloud Platform, App Engine (without using Gitlab CI)? 在 Google Cloud AI 平台上安装 libspatialindex - Install libspatialindex on Google Cloud AI platform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM