Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
Can anyone tell me how to run the Python program in Ubuntu?

1 Answer

0 votes
by (108k points)

You can run your python program by calling the Interpreter:

For Python 2: python <filename>.py

For Python 3: python3 <filename>.py

Or, you can call the Interpreter through the script with the help of the below steps:

Step 1: You have to keep one thing in mind that the first line of the file must have #!/usr/bin/env python

Step 2: Now, you have to make your file executable with the help of the code chmod +x <filename>.py

Step 3: Finally, you can execute your file as ./<filename>.py

If you are looking for an online course to learn Python, I recommend this Python Certification program by Intellipaat.

Related questions

0 votes
1 answer
+5 votes
2 answers
0 votes
1 answer
asked Jul 11, 2020 in Python by ashely (50.2k points)
0 votes
0 answers
asked Jul 17, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.6k points)

Browse Categories

...