In ubuntu By default python version was 2.7. We need to use python3 to run the python files with the latest version.
Steps to change the default python version to 3
Check the current version
#python --version
Python 2.7.17
Execute this command to switch to python 3.6.
#sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
Output:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode
Check python version
python --version
Python 3.6.9
No comments:
Post a Comment