python 3.7.3 shell用法_如何在Google Cloud Shell中安装Python 3.7

I have python 3.5 on my google cloud shell and want 3.7 so I can do command line debugging of code I am going to deploy via google cloud functions (and use 3.7 features such as f-strings).

I try various forms of the following:

sudo apt-get install python37

and always get back

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package python37

Any help would be really appreciated!

解决方案

This worked for me on the GCP shell.

# Install requirements

sudo apt-get install -y build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev openssl libffi-dev python3-dev python3-setuptools wget

# Prepare to build

mkdir /tmp/Python37

cd /tmp/Python37

# Pull down Python 3.7, build, and install

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz

tar xvf Python-3.7.0.tar.xz

cd /tmp/Python37/Python-3.7.0

./configure

sudo make altinstall

Then you would just call Python like so:

python3.7 ./yourScript.py

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值