Ubuntu – How to make side-by-side Python 2.7 and 3.2 installs on Ubuntu 12.04,

pythonpython3.2ubuntu 12.04

I just installed Ubuntu 12.04 and Python 2.7 is pre-installed. I want also to have 3.2, and to be able to select one as the default with no arguments and the other to be specified by command line argument.

I guess I'm asking how to set environment variables analogous to PATH in Windows7, right?

Best Answer

It's impossible to use the command python using python3.2 because Ubuntu uses python2.7. You can try using #!/usr/bin/python3 in that first line of your python code to use python3.2.

To install python3.2 in Ubuntu:

Go to the console and put this:

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

After that, go to the console and enter python3. This will be python3.2 and python will be python 2.7.