启动时运行python脚本

编程入门 行业动态 更新时间:2024-10-27 14:21:36
本文介绍了启动时运行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脚本

本文发布于:2023-11-05 06:23:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560142.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:启动时   脚本   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!