Currently, when I type "python" at the terminal I get v2.6 which is all fine and dandy but how can I set it to use v3.1 instead? Is there a "path" variable out there somewhere that I can change like windows?
EDIT: I already have python3 installed and up and running. I just want to know how to set it as the shells default python version.
Use python-virtualenv to create a virtual python environment.
Select the version of Python to be created in the virtual environment:
To manage multiple virtual Python environments, install the virtualenvwrapper extension.
Why virtualenv?
First of all, you need to install the
python3
package. After installing it, go to a terminal and type:then choose python3 from the list that's presented.
If it does not work, you may need to recreate the symlink. First save it:
afterwards, create the alternatives:
create a new symlink:
Finally, choose the one (python3) you want to use:
And if you need to go back to python2, just repeat the command:
I guess just install the package and update-alternatives will work very well, you may don't need to recreate links from scratch. Thanks!
EDIT: As pointed out here the
update-alternatives
with the--install
options accepts an absolute link, so you may need to run:First install Python 3.1 using the dead snakes repository: https://launchpad.net/~fkrull/+archive/deadsnakes
Then you can type 'python3' at the command line to run Python 3.1 while retaining the normal system Python.