Changing python version without breaking software center
Solution 1:
You shouldn't change the symlink for python
to point to Python 3 as you have already seen its consequences. And I would recommend you to get into the habit of calling Python 3 programs with python3
as that would involve the least amount of trouble later on.
But if you insist on calling Python 3 on your Terminal using python
, you may create an alias for it. Remember, alias is different than symlink. Edit ~/.bash_aliases
file (create it if it doesn't exist) to add the following in it:
alias python='python3.2'
Then restart your terminal and you would be able to execute Python 3 by calling python
. This wouldn't break anything as changing the symlink does.
You may even add aliases like alias py3='python3.2'
and then call py3
to run Python 3. This is even shorter and less confusing.
Solution 2:
Don't do that:
- The Python programs that come with Ubuntu depend on
/usr/bin/python
being the default Python2 version of your distro. They will likely break if it is something else. -
PEP-0394 recommends that the
python
command calls Python2. Most Python programs will break if it calls Python3 instead.
Instead use /usr/bin/python3
if you want to use Python3