Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am very new to Ubuntu. If I use IDLE I am using Python 3.3.2+, whereas if I go the terminal and type python --version it says I am using 2.7.5+. As these versions are not compatible with each other, I can not run code created in IDLE from the Terminal. So how do I make sure that I am only using one version of python in ubuntu.

share|improve this question
add comment

1 Answer

Python 3 has introduced a number of backwards incompatible changes. That is why your python 3 code does not run without error when using the python command. To answer your question "how do I make sure that I am only using one version of python in ubuntu", you should note that the two python versions live in peaceful cohabitation. They can coexist. In a terminal just use the command python to run your python 2 code and python3 to run your python 3 code.

In response to Rahil's comment on why Ubuntu ships with two python versions:

  1. A lot of software was written for python 2 and is not "ported to" or adapted for python 3 yet. There is also some software in Ubuntu that still needs python 2. In the future this will most likely no longer be the case.
  2. There are quite a number of python third party packages (bits of software that you can reuse in your own software or toolbelt). Not all of these packages have been converted to python 3 either.
share|improve this answer
    
@donjoey Please can you explain why there is two version of python in ubuntu. By default ubuntu comes up with python2x. Is ubuntu have any application to run in python? –  Rahil Wazir Dec 10 '13 at 9:25
add comment

Your Answer

 
discard

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.