Various versions of Python can be used in Linux.
These instructions were for Slackware, but I suppose they work well in other distributions.
Install pyenv as root:
1. cd /root
2. curl -L
https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
update your .bashrc (or create it if not exists) and add this:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
load the new .bashrc with source .bashrc
now install the python version that you want like:
pyenv install 3.7.2 (you can have multiple versions installed at the same time)
(you can check for the available versions with: pyenv install --list)
Switch to the new version with:
pyenv global 3.7.2 and run slpkg.
When you finish with it you can switch back to your original python with:
pyenv global system
And finaly check for the available python versions in your system with:
pyenv versions (the first 'system' means the python that is installed by your system)
For example this is from mine:
root@lab:~# pyenv versions
system
3.1.2
3.5.5
* 3.7.2 (set by /root/.pyenv/version)
References:
https://github.com/pyenv/pyenvIt seems that pyenv only reports the python versions installed into it.