Although you did not explicitly tell, you have set up and are using pyenv
. This is a tool written in bash
that allows to manage different python version on a per user basis.
To change your default python version, you need to use the tool. Currently, your python version may still be set to the python version installed with the Ubuntu system.
- List the available python versions with the command
pyenv versions
- Then change the default python version with a command like
pyenv global 3.6.8
Adapt 3.6.8
according to the output you found in step one.
Besides setting the global default python version for you user, you can set different default python version for different projects. Inform yourself to learn more about the tool pyenv
.
Beware that which python
will continue to point to /home/tanvir/.pyenv/shims/python
. This is because of the way pyenv
works. That executable is a "shims", a short bash script that converts your python
command to a call to the configured default python version.
If step 1 does not reveal any python version apart from system
, you will need to install some python versions using pyenv
.
For users not using pyenv
, Ubuntu provides packages to install a symbolic link that points to the desired python version, i.e., python-is-python2
and python-is-python3
. On the latest Ubuntu versions, python2
is not installed by default, and only the latter package is available.