Do we have to install Python or It is already installed in Ubuntu 14.04LTS?

I need it for learning Python language. Please Help!


By default, both python2 and python3 are installed.

As already mentioned, you can check your version with either:

python -V

(mind the capital) or

python --version

or

apt-cache policy python

However

This will only show the version of python2, while on 14.04, python3 is installed as well. To see the version of python3, simply replace all occurrences of python in the commands above by python3

Note

If you start coding, also mind that using:

python <script>

will make python 2 run the code, and

python3 <script>

will make python 3 run it, and (if the script is executable), the shebang

#!/usr/bin/env python

will run it in python 2, and

#!/usr/bin/env python3

will run it in python 3

Using Idle

As an answer to what you asked in a comment: So it is the "terminal" where we do the coding,right!?

The most convenient way is to use Idle (from the repositories). You can then test-run the code with F5, or if necessary from the terminal. It has the advantage that indentation is suggested automatically (a.o.)

Mind that you need to use different version of Idle for python 2 and 3.


Check your python version with

python --version

Also note that there are some severe differences between python 2 and 3. https://wiki.python.org/moin/Python2orPython3


Python is installed by default in Ubuntu, but to check it:

Run this command

$ apt-cache policy python


python:
  Installed: 2.7.3-0ubuntu2.2
  Candidate: 2.7.3-0ubuntu2.2
  Version table:
 *** 2.7.3-0ubuntu2.2 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.7.3-0ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Thanks to @JacobVlijm note if you use Ubuntu >12.10 then you should use apt-cache policy python3 instead

As you see under pyton section you can see Installed: 2.7.3-0ubuntu2.2 This means it's installed and the version is 2.7

Also the candidate shows you the latest version available in your software channel, so you can upgrade your version if you want.