How To Python3 Ubuntu 20.04 Using ASDF

Published on 26 November 2020 12:00 AM
  1. Git clone the ASDF repo
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
  1. Add the following line to your ZSH config file ~/.zshrc
. $HOME/.asdf/asdf.sh
  1. Restart ZSH config
source ~/.zshrc
  1. Install ASDF plugins
asdf plugin add python
  1. Install Dependencies for Python
sudo apt-get update; sudo apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
  1. A common request for Python is being able to use the python2 and python3 commands without needing to switch version. This can be achieved by setting multiple versions of Python, for example with Install Python3 and Python2 manage versions
asdf install python 3.9.0
asdf install python 2.7.13
asdf global python 3.9.0 2.7.13
asdf reshim
python --version
python2 --version