Raspbian Python脚本错误

问题描述 投票:-1回答:1

嗨其他程序员。

我试图让我的python脚本在我的Raspberry Pi 3上的Linux / Raspbian启动时自动启动。

我按照本教程:http://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/?ALLSTEPS

当我执行sh launcher.sh时,我的GUI打开,一切正常。但是当我开机的时候什么也没出现。

转到crontab日志时,我收到以下错误:

Traceback (most recent call last):

File "CCM-Interface.py", line 76, in <module>

root = Tk()
  File "/usr/lib/python3.4/tkinter/__init__.py", line 1854, in __init__

self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
python raspberry-pi raspbian boot
1个回答
0
投票

我通过以下方式修复它:

我在终端中输入以下内容编辑了以下文件:

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

并添加此行:

@sh /home/pi/GUI/launcher.sh
© www.soinside.com 2019 - 2024. All rights reserved.