Linux Python 101

0
577

Python is one of the most popular programming languages of all, no doubt. In the case of any Linux distro, Python is completely irremovable as it performs lots of important tasks from the core to any software. Today, let’s take a look at some of the basic Python commands and tricks.

Python versions

At first, you have to know that there are 2 major versions of Python – Python 2.x and 3.x. Python 2.x is the older release. It’s still quite good, but not actively maintained. That makes Python 3.x the obvious choice for the long run. There are some syntax changes in Python 3.x, so for compatibility, both are required to be present in your system.

For installing Python in your Linux system, run the following command(s) according to your distro.

  • Ubuntu

  • Debian

  • OpenSUSE

  • Fedora

Python comes pre-installed on Fedora. Make sure to grab the latest version by upgrading all your software package to the latest version.

  • Arch Linux

Download Python 3.x and/or Python 2.x for Arch Linux.

  • Other distros

For other distros, you have to build it from source. Download the latest source of Python. Extract the compressed file into a suitable folder.

Then, run the commands:

Python commands

Here are some of the basic commands of Python.

This command shows the installation path of Python binary.

 

Check out installed Python version –

Exit Python shell –

It’s always a good idea to make sure to use the latest version, right? You can symlink the command “python” with “python3”. Run the following commands –

For developers, there’s an official Python IDE (IDLE). Let’s install and fire it up.

Now, install the favorite version of yours like the following command:

Of course, the IDE looks more like the shell, but it’s better to keep in mind that you have more power on IDLE than the shell.

There are also other Python IDEs and editors like Thonny, PyCharm, Visual Studio Code etc. There are also other IDEs worth checking out. Take a look at the best IDEs of 2018.

Spread the love
  • 3
    Shares

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here