在启动时运行 python 脚本 - debian [英] run python script on startup - debian

查看:38
本文介绍了在启动时运行 python 脚本 - debian的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用网络摄像头创建了一个应用程序.在这里,我的应用程序打开一个窗口来显示图像.我想在启动时运行该应用程序.如果我将启动文件放在 rc.local 中,它会在启动时成功运行但不允许显示窗口.它显示 -

I have created an application using webcam. here my application opens a window to display the image. I want to run that application on startup. if i put startup file in rc.local, it runs successfully at startup but not allowing to show window. it shows -

gtk warning cannot open display.

如何显示窗口?请大家帮帮我!!

how to show window? please help me guys!!

推荐答案

如果您运行的是 LXDE(raspbian 上的默认设置)

If you're running LXDE (default on raspbian)

将 .desktop 文件添加到您的 ~/.config/autostart 目录(如果不可用,请创建一个),其中包含 3 行内容:

Add a .desktop file to your ~/.config/autostart directory (create one if not available) with 3 lines saying :

[Desktop Entry] 
Type=Application
Exec=python /path/to/your/application.py arguments

更新:更新了唐问题的评论

UPDATE: updated with Don Question's remark

这篇关于在启动时运行 python 脚本 - debian的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆