如何在Google Cloud Platform中为Node应用安装Python3 [英] How to install Python3 in Google Cloud Platform for a Node app

查看:73
本文介绍了如何在Google Cloud Platform中为Node应用安装Python3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的nodejs应用程序使用Google云平台.问题,在部署应用程序后,我可以访问python2.7,但不能访问版本3.在usr/bin文件夹中似乎缺少此版本.

I'm using google cloud platform for my nodejs app. 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.

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

Error: spawn python3 ENOENT

我使用fs模块显示usr/bin文件夹:

I used fs module to display the usr/bin folder :

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

任何想法都可以在应用程序部署期间如何安装python3吗?也许要更改app.yaml文件?

Any idea how can I install python3 during the deployment of the app ? Maybe changing the app.yaml file ?

谢谢

推荐答案

如果您需要同时具有特定版本的Node.js和Python的运行时,则最好使用

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.

Flex也可以在这里工作,但是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.

这篇关于如何在Google Cloud Platform中为Node应用安装Python3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆