Come eseguire un programma Python su LXTerminal Raspberry Pi
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 = datetime.datetime.now() print str(dt)
and save the fine on Desktop with name DateTimeProgram.py
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:
python DateTimeProgram.py
The program should now be running and print the dae and time on the output console.
Se sei un neofita nell’utilizzo di Python sul modulo Raspberry Pi, questo è un articolo che potrebbe esserti d’aiuto.
Creaiamo innanzitutto un semplice programma Python direttamente dal modulo RPi utilizzando l’editor di testo LeafPad fornito direttamente con l’istallazione di Raspbian.
Dunque, apriamo LeafPad, incolliamo la seguente porzione di programma Python:
import datetime dt = datetime.datetime.now() print str(dt)
e salviamo il file sul Desktop con il nome DateTimeProgram.py
Una volta creato il file sul Desktop, apriamo il terminal di Raspbian LXTerminal ed inseriamo il seguente comando per posizionarci nella cartella contente il programma (Desktop):
cd /home/pi/Desktop
successivamente, digitare il seguente comando per eseguire il programma Python e premere Invio:
python DateTimeProgram.py
Il programma dovrebbe avviarsi e visualizzare sulla console di output la data e l’ora corrente.
2 commenti