事前に必要
sudo apt update
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
pyenv
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
install
pyenv install 3.8.2
globalに
pyenv global 3.8.2
バージョン確認
python -V
こんな感じででればOK
$ python -V
Python 3.8.2