I want to use Python 3.9 with CloudShell.

0

I would like to use Python 3.9 with CloudShell.
Python 3.9 is required in pyenv because Python 3.9 is used in the Lambda runtime.
I tried to use Python 3.9.17 with pyenv by running the following command, but the command gets stuck at the "pyenv global 3.9.17" stage.
Is it possible to use Python 3.9 without pyenv in CloudShell?

sudo yum install gcc
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
source .bash_profile
pyenv install 3.9.17
pyenv global 3.9.17
profile picture
專家
已提問 10 個月前檢視次數 600 次
2 個答案
1
已接受的答案

The sam build now succeeds by installing Python 3.9 from source using the following method.

!#bin/bash

sudo yum install gcc openssl-devel bzip2-devel libffi-devel -y
wget https://www.python.org/ftp/python/3.9.17/Python-3.9.17.tgz
tar xzf Python-3.9.17.tgz
cd Python-3.9.17
./configure --enable-optimizations --prefix=$HOME/.local
sudo make altinstall
profile picture
專家
已回答 10 個月前
profile picture
專家
已審閱 10 個月前
0

!#bin/bash

sudo yum install gcc openssl-devel bzip2-devel libffi-devel -y wget https://www.python.org/ftp/python/3.9.17/Python-3.9.17.tgz tar xzf Python-3.9.17.tgz cd Python-3.9.17 ./configure --enable-optimizations --prefix=$HOME/.local sudo make altinstall

已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南