How do I install Python 3.7 in google cloud shell

前端 未结 4 1222
栀梦
栀梦 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 01:43

    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

    Src: https://serverfault.com/questions/918335/best-way-to-run-python-3-7-on-ubuntu-16-04-which-comes-with-python-3-5

提交回复
热议问题