How to install 'pyenv' Python version manager on Ubuntu 20.04

Overview:

pyenv - is a simple Python version manager tool, which allows you easily switch between multiple versions of Python. You can set local or global system-wide Python versions via the tool.

Installation:

  1. Install all required prerequisite dependencies:

    COPY

    sudo apt-get update; sudo apt-get install 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
    
  2. Download and execute installation script:

    COPY

    curl https://pyenv.run | bash
    
  3. Add the following entries into your ~/.bashrc file:

    COPY

    # pyenv
    export PATH="$HOME/.pyenv/bin:$PATH"
    eval "$(pyenv init --path)"
    eval "$(pyenv virtualenv-init -)"
    
  4. Restart your shell:

    COPY

    exec $SHELL
    
  5. Validate installation:

    COPY

    pyenv --version

If you need assistance with your projects feel free to email me at info@airgad.com or whatsapp Jesse stay safe!