Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the simply-static domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6121
树莓派开机启动python程序或gui程序

树莓派开机启动python程序或gui程序

如果希望在树莓派开机进入界面后,自动启动python的gui程序,以gui.py文件为例:

1、给文件设置运行权限

chmod +x gui.py

2、在这个gui.py文件最开始,加上python编译器的地址

比如 #!/usr/bin/env python

如果不清楚python编译器的地址是什么,可以用 which python命令查看。如果是用python3,则用 which python3

3、打开自启动的文件(以用户为pi为例)

sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart

最下面增加一行

@/home/pi/Downloads/gui.py