Question: I have been using Emacs to write Python 2 code. Now I have both Python 2.6 and 3.0 installed on my system, and I need to write Python 3 code as well.

Here is how the different versions are set up in /usr/bin:

```
python -> python2.6*
python2 -> python2.6*
python2.6*

python3 -> python3.0*
python3.0*

```

Is there any way to set this up so that Emacs uses the correct version of Python, depending on which language I am using? For instance, C-c C-c currently runs the buffer, but it always calls python2.6, even if I am writing Python 3 code.

Answer: 
The answer is yes. If you can distinguish Python 2 from Python 3, then it is a Simple Matter Of Programming to get emacs to do what you want.

```
(define run-python (&optional buffer)
    (with-current-buffer (or buffer (current-buffer))
        (if (is-python3-p)
              (run-python3)
            (run-python2))))

(define-key python-mode-map (kbd "C-c C-c") #'run-python)

```

All that's left to do is implement `is-python3-p` and `run-python3` (etc.)
With current `python-mode.el` shebang is honored.

Interactively open a Python shell just with

```
M-x pythonVERSION    
M-x python

```

will call the installed default.

<http://launchpad.net/python-mode>