개발을 하다보면 로컬에 여러 버전의 파이썬이 필요한 경우가 있다.
그럴 경우 사용하면 좋은 python version manager 이다.
node의 nvm과 같은 것이다.
Ubuntu 20.04에 설치하는 법을 기록해 둔다.
$ sudo apt update && sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git
$ curl https://pyenv.run | bash
# Load pyenv automatically by appending
# the following to
~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
and ~/.bashrc (for interactive shells) :
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Restart your shell for the changes to take effect.
# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:
eval "$(pyenv virtualenv-init -)"
$ exec $SHELL
$ pyenv --version