Nota da autora: Você pode ler este artigo em Português.

One of the first things we learn in Python is that there is more than one version of the same language working side by side. That can bring a few problems and the inevitable question: “Which version should I choose?”. Today’s tip teaches you a way to install and manage many Python versions on your machine using pyenv 😉.

Amongst other things, the two best features of pyenv in my humble opinion are:

  1. install new Python versions easily;
  2. choose the global Python version.

To start you’ll need to install pyenv, here I’ll demonstrate one of several installation methods, but in the project’s readme file you can find other possibilities (and also operational system related details):

$ git clone ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ exec "$SHELL"

After these easy steps, other versions of Python are an install away:

$ pyenv install 3.6.4

When in doubt of which version you can install, just use the install flag -l that it lists all versions available:Se estiver em dúvida quais versões você pode instalar só usar a flag -l do install que ele vai listar todas as disponíveis:

$ pyenv install -l

Cool huh? Now you can install version like crazy 😂