HOW TO CHECK A PYTHON IN A LINUX

 

Python on Linux

Linux systems are designed for programming, so Python is already installed on most Linux computers. The people who write and maintain Linux expect you to do your own programming at some point and encourage you to do so. For this reason there’s very little you have to install and very few settings you have to change to start programming.











Checking Your Version of Python

Open a terminal window by running the Terminal application on your system (in Ubuntu, you can press ctrl-alt-T). To find out whether Python is installed, enter python with a lowercase p. You should see output telling you which version of Python is installed and a >>> prompt where you can start entering Python commands, like this:

This output tells you that Python 2.7.6 is currently the default version of Python installed on this computer. When you’ve seen this output, press ctrl-D or enter exit() to leave the Python prompt and return to a terminal prompt.
To check for Python 3 , you might have to specify that version; so even if the output displayed Python 2.7 as the default version, try the command python3:

This output means you also have Python 3 installed, so you’ll be able to use either version. Whenever you see the python command in this book, enter python3 instead. Most Linux distributions have Python already installed

Python Code
$ python





        
Python Code
$ python3





        

Comments