• Register

In, this tutorial we will discuss about python and how to run python in Linux operating system. if you are new in python and Linux then this article for you.

Here, you need to follow some simple given command and run these commands in your Linux terminal then you will get your python program running.

Step1: In the first step you need to open your text editor, but I will using sublime text

Step2: After opening text editor you need to create a new file (just press key;-ctrl+n) and save this file in your directory, I’m saving this python file in Home by default but don’t forget the .py extension for saving a python file.

Step3: Here you need to open your terminal(press ctrl+alt+t).

Step4: In this step just type a command in your terminal if you save your python file in the Home directory then you don't need to go to another directory.

Step5: Now, Its time to run a python program in a Linux terminal, just type this command in your terminal 

$ python3 filename.py

Here, I’m using python3 if you are working on python2 then you need to use python2 instead of  python3  in the cmd line.

After using this command you will see your python program is running.

 

110 points
3