How can I uninstall python 2.7 and reinstall 3.5 ?

How can I uninstall python 2.7 and reinstall 3.5 ?

Answer: You Can’t !

But we have a solution ūüėČ

By default in latest Ubuntu release python and python3 are already included and if you completely remove python 2.7 it may break your system type in terminal

python3

to open python 3 interpreter and when you run your scripts type

python3 Scriptname

and if not already included type in terminal

sudo apt-get update && sudo apt-get install python3

 

ONCE PYTHON3 IS INSTALLED,  CREATE AN ALIAS FOR PYTHON TO CALL PYTHON3 INSTEAD.

Add

alias python=python3

at the bottom of ~/.bashrc file (or simply echo "alias python=python3" >> ~/.bashrc)

Than do:

source ~/.bashrc

from the terminal to update bash with the changes.

Leave a Reply

Your email address will not be published. Required fields are marked *