Running Python Script Terminal Raspberry Pi

I just bought a raspberry pi and I want to run a python script from the terminal. How can i do this?

+3


source to share


2 answers


You either start your python interpreter using the script name as an argument:

$ python script.py

      

Or do you start your script with

#!/bin/python3

      

make it executable:



$ chmod u+x script.py

      

and run it directly from the shell

$ ./script.py

      

Or you can start your python interpreter and load your script interactively.

+6


source


Usually you open a new terminal window and you type this:



$ python script.py

      

+3


source







All Articles