0 votes
1 view
in Python by (43.2k points)
Can anyone tell me how to run the Python program in Ubuntu?

1 Answer

0 votes
by (92.8k 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
+7 votes
2 answers
0 votes
1 answer
asked Jul 11 in Python by ashely (43.2k points)
0 votes
0 answers
asked Jul 17 in Python by ashely (43.2k points)
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.8k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !