Published on

Install pyenv

Authors
  • avatar
    Name
    Loc Truong
    Twitter

Install and Update Dependencies

apt update -y
apt 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

Download the Script of Pyenv in Ubuntu

curl https://pyenv.run | bash

Set the Environment Up

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"

Look over the Installation

pyenv install --list
pyenv install 3.8.3
pyenv versions
pyenv global 3.8.3

Commands Useful

pyenv help