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

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

问题描述

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

  gtk警告无法打开显示。 

如何显示窗口?请帮助我们!

解决方案

如果您正在运行LXDE(默认为raspbian)



将.desktop文件添加到〜/ .config / autostart目录(如果不可用,请创建一个)3行说:

  [桌面条目] 
Type =应用程序
Exec = python /path/to/your/application.py参数

更新:更新Don问题的说明


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!!

解决方案

If you're running LXDE (default on raspbian)

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天全站免登陆