How do I install Python 3.7 in google cloud shell

前端 未结 4 1181
栀梦
栀梦 2020-12-08 01:27

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

4条回答
  •  失恋的感觉
    2020-12-08 02:05

    
    # install pyenv to install python on persistent home directory
    curl https://pyenv.run | bash
    
    # add to path
    echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(pyenv init -)"' >> ~/.bashrc
    echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
    
    # updating bashrc
    source ~/.bashrc
    
    # install python 3.7.4 and make default
    pyenv install 3.7.4
    pyenv global 3.7.4
    
    # execute
    python
    

    This is based on @yungchin answer.

提交回复
热议问题