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: 
If you are using python-mode.el you can try to change `py-which-shell`. In order to do this on a per-file basis you can put

```
# -*- py-which-shell: "python3"; -*-

```

at the first line of your file - or at the second line if the first line starts with `#!`.
Another choice is to put

```
# Local Variables:
# py-which-shell: "python3" 
# End: 

```

at the end of your file. Perhaps you should give the full path to python3 instead of just "python3".
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>