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

久未见 提交于 2021-01-27 14:12:35

问题


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

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

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

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

Thank you


回答1:


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 would also possibly work here, but Cloud Run will likely be significantly cheaper, have faster startup times, and can scale to zero.



来源:https://stackoverflow.com/questions/55829115/how-to-install-python3-in-google-cloud-platform-for-a-node-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!