Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed ubuntu 3.10 and, although this version is still reliant on python 2 as the default, the python 3.3 interpreter is listed as installed in the software centre. Does this mean that python 3.3 is already here somewhere, and if so how do I access it to run my code?

I know there are many questions about installing python 3.3 alongside 2.7.x in Ubuntu (and definitely not replacing it!), but it seems to be already installed. However, in terminal I get 2.7.5 when I type 'python' and the online documentation says that it was not possible to break the reliance on python 2 for this ubuntu release. I was expecting to have to install it in a different directory, but if this has already been done then I could avoid messing with a critical bit of ubuntu.

Thanks for your help!

share|improve this question
up vote 6 down vote accepted

If you want to use Python 3, run python3 instead of just python. You can also use Python 3 for your scripts, if you add

#!/usr/bin/env python3

as the first line.

share|improve this answer
very helpful post! Is Python 3 default to 13.10? – Arup Rakshit Jan 18 '14 at 9:23
vic@vic-UX32VD ~/projects/mykde (master) $ which python

vic@vic-UX32VD ~/projects/mykde (master) $ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 нояб. 23 06:52 /usr/bin/python -> python2.7

vic@vic-UX32VD ~/projects/mykde (master) $ ls -l /usr/bin/python3*
lrwxrwxrwx 1 root root       9 нояб. 23 06:52 /usr/bin/python3 -> python3.3
-rwxr-xr-x 1 root root 3892168 окт.   9 19:38 /usr/bin/python3.3
-rwxr-xr-x 1 root root 3892168 окт.   9 19:38 /usr/bin/python3.3m
lrwxrwxrwx 1 root root      10 нояб. 23 06:52 /usr/bin/python3m -> python3.3m

vic@vic-UX32VD ~/projects/mykde (master) $ 

As you see when you type python python2.7 is executed, because of the symlink.

If you need to run a Python script using Python3, either add shebang line to the beginning of your script: #!/usr/bin/env python3 (you then run it like ./ given that you first made it executable using chmod +x a_script.py1) or run your script like python3 (which is easier).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.