Raspberry Pi automatically runs Python scripts when booting

The first step is to give your script permission. For example, the name of the script you want to execute is test.py, then enter its directory first, and then execute

sudo chmod 777 test.py

The second step is to open /etc/rc.local

sudo nano /etc/rc.local

The third step is to add the execution script command in the /etc/rc.local file (the line above the statement exit 0)

python3 /home/pi/test.py

Guess you like

Origin blog.csdn.net/qq_50866711/article/details/113767823