How to run Python program on Raspberry Pi LXTerminal

How to run Python program on Raspberry Pi LXTerminal

If you are new to using Python on the Raspberry Pi, this article may help you.
First of all, let’s create a simple Python program directly from RPi module, using LeafPad text editor provisioned out of the box with Raspbian operating system.
Therefore, let’s open LeafPad, past the following Python program code snippet:

import datetime

dt =

print str(dt) 

and save the fine on Desktop with name

Now open Raspbian terminal LXTerminal and type the following command to reach the Desktop folder:

cd /home/pi/Desktop

Next, type the following command to run DateTimeProgram Python program and type Enter key:


The program should now be running and print the dae and time on the output console.


comments user

un altro modo รจ quello di aggiungere al file, nella prima linea, lo shabang

dare i diritti di esecuzione al file con

chmod +x

ed infine eseguire direttamente il file, sempre dalla dir Desktop,


    comments user
    Nicola Celiento

    Grazie Emiliano per l’ottimo contributo!

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.