I have installed Python 3.6.5 however when i type Python it shows Python 2.7.5.
Id like to use Python 3.
[aravind@aravind05 Python-3.6.5]$ python3 --version
Python 3.6.5[aravind@aravind05 Python-3.6.5]$ python
Python 2.7.5 (default, Apr 11 2018, 07:36:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
I want to use Python 3
There are multiple ways to achieve this.
Assuming you are on some *NIX OS using a bourne-shell-like shell, you could define an alias alias python python3
.
You could also place a symlink named 'python', pointing to python3 into a directory that is listed earlier in your PATH:
# on debian-like distributions, the following directories should be reasonable
ln -s ~/.local/bin/python "$(which python3)"
# place the following line into your .bashrc
export PATH="~/.local/bin/python:$PATH"