Python Programming (136 Blogs) Become a Certified Professional
AWS Global Infrastructure

Data Science

Topics Covered
  • Business Analytics with R (26 Blogs)
  • Data Science (20 Blogs)
  • Mastering Python (86 Blogs)
  • Decision Tree Modeling Using R (1 Blogs)
SEE MORE

How To Run Python In Ubuntu (Linux)?

Last updated on Jul 05,2024 81.7K Views

2 / 6 Blog from Python Installation

This article will introduce a very simple yet interesting and important concept that is How To Run Python In Ubuntu (Linux)? with a detailed practical demonstration. So let us get started then.

To get in-depth knowledge on Python Programming language along with its various applications, you can enroll now for Python course training with 24/7 support and lifetime access.

How to run Python in Ubuntu (Linux)

If you are curious about how to run Python in Ubuntu, here’s an article dedicated for it which may help you out. We are here using Ubuntu Version 14.04. It supports Python 2 and Python 3 versions.

So here is the first step.

Image- How to run Python in Ubuntu- Edureka

Step1:  Open your desktop like this.

Image- How to run Python in Ubuntu- Edureka.jpg

Step2: Go for Files > Documents in the left hand side.

Image- How to run Python in Ubuntu- Edureka

Step3:  In documents, you can either go for a folder in which you want to save your program or directly make a program there itself.

Image- How to run Python in Ubuntu- Edureka

Step 4: Right click in that area and select a New Document > Empty document.

Image- How to run Python in Ubuntu- Edureka

Step 5: Name your file with a .py extension so that the system can detect it is a python file.

Image- How to run Python in Ubuntu- Edureka

Step 6: Open your file and you’ll find out the file opens in ‘gedit’.

Write down your desired program in the given area and save it.

Image- How to run Python in Ubuntu- Edureka

Step 7: Open Terminal in left hand side down corner.

Step 8: Once done, we have to change the directory so that it’s easy access for us to fetch the code.

Step 9: For that the linux command is cd Documents/ wherever your file is saved.

Step 10: Once done, enter and you are in that particular directory.

Step 11: Now to run your Python file, all you have to command is ‘python yourfilename.py’.

Step 12: It basically tells the terminal to run the python file.

Image- How to run Python in Ubuntu- Edureka

Step 13: In case if you want to check which version of Python are you using, you can write python –version.

Step 14:  Instead of using Python 2 version, if you use Python 3 version, you can readily execute it by writing ‘python3 yourfilename.py’.

Step 15: Make sure while executing your Python code in Python 3 version, you use the syntax according to Python 3. Example : Python 2 print statement may or may not have ( ) with print statements but in Python 3, print statements should be with ().

Image- How to run Python in Ubuntu- Edureka

I hope that you learnt the concepts well and hence try it out to be more accurate. This brings us to the end of this article on How To Run Python In Ubuntu (Linux)?

Got a question for us? Please mention it in the comments section of “How To Run Python In Ubuntu (Linux)?” article and we will get back to you at the earliest.

Upcoming Batches For Python Programming Certification Course
Course NameDateDetails
Python Programming Certification Course

Class Starts on 30th November,2024

30th November

SAT&SUN (Weekend Batch)
View Details
Python Programming Certification Course

Class Starts on 28th December,2024

28th December

SAT&SUN (Weekend Batch)
View Details
Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

How To Run Python In Ubuntu (Linux)?

edureka.co