1

The default version of python in my Ubuntu 18.04 is 2.7. I've already used the command: alias python=python3

but it changes the python version temporarily, as soon as I close the terminal and re-opens it the version again changes to python 2.7.

Is there any permanent solution to this issue?

Ashish Siwal
  • 61
  • 2
  • 8
  • You could add that command to your .bashrc so it is executed as you login. – Stefan Hamcke Sep 26 '18 at 19:15
  • 3
    As mentioned in many, many previous posts, DON'T change the links to the various versions of python, It will break stuff that depends on specif versions. – Jacob Vlijm Sep 26 '18 at 19:17
  • @JacobVlijm changing the symlinks will break things, but I think aliases should be safe, since scripts can't use them. I might be wrong, though. – Chai T. Rex Sep 26 '18 at 19:23

1 Answers1

1

See this existing question about creating a bash alias permanently:

How do I create a permanent Bash alias?

Essentially you want to edit the file ~/.bashrc and put that command somewhere (likely near the bottom) in there. The linked question is pretty old (2010) and mentions gedit but you don't have to use that text editor to modify the file, you can use whatever text editor you want.

  • 1
    Thank you sir!. This solved my issue but don't remove my question as it's different issue than the question you mentioned. It'll help someone else like me in future :) – Ashish Siwal Sep 26 '18 at 19:36