Install and use multiple Python versions
First, we need to list the all available versions of Python, including Anaconda, Jython, pypy, and stackless in our system. Use the following command to list them all:
Now, that you have a list you can decide which versions of Python you want to install. You can install the desired versions with the following command:
Last step before use the desired version, now that you have installed the latest and required version we need to set the priority of the version to use. The global
command allows us to set global version(s) of Python to be used in all shells. Thus, if we want to use version 2.7.12 over version 3.5.2 following command will do the trick:
Remember, the leading version always takes priority so in our case v2.7.12 is going to be the default.
All installed Python versions can be located in ~/.pyenv/versions
. Alternatively, you can run:
This shows an asterisk *
next to the currently active version.
Last updated