您可以搜索in here(如果存在具有该特定 Python 版本的映像),或者您可以选择任何 Linux 分发映像并在其中安装该特定 Python 版本。
对于后一种情况,这是一个工作示例:
ZONE=us-central1-a
INSTANCE_ID=my-vm-00
gcloud compute instances create $INSTANCE_ID --machine-type n1-standard-1 --image-project debian-cloud --image debian-9-stretch-v20190326 --metadata startup-script="sudo apt update && sudo apt install gcc make -y && wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz && tar xvf Python-3.5.5.tgz && cd Python-3.5.5 && sudo ./configure --enable-optimizations && sudo make altinstall" --subnet default --zone $ZONE
查看Google Cloud SDK 了解有关上述命令的更多背景信息。
使用以下命令,您可以检查哪些 Python 3.5.x 可用(但在最后一个命令返回后您必须等待几秒钟)。
gcloud compute ssh $INSTANCE_ID --command 'for pythonv in python3 python3.5; do type $pythonv; $pythonv --version; done' --zone $ZONE
只记得在需要 Python 3.5.3 时使用 python3.5 可执行文件。
要部署您的代码,您可以使用以下命令:
gcloud compute scp --recurse my_code_local/ $INSTANCE_ID:~ --zone $ZONE
或者按照Cloud Build 的思路研究解决方案。
要从您的 Python 应用程序向 Google Cloud Storage Bucket 上传或下载数据,您只需使用Cloud Storage Client Libraries。
还有with links的例子,用它来进行下载和上传操作。