我有一个想在启动时启动的Python应用程序。它使用Tkinter,因此需要图形环境。 正在运行: QTerminal命令行中的python /home/debian/eme/myprog.py可以正常运行。我认为这不在LXQT环境之外。 我做了一个服务文件:myprog.service像这样:
[Unit]
Description=to invoke myprog automatically on boot
Requires=graphical.target
[Service]
Type=simple
WorkingDirectory=/home/debian/eme/
ExecStart=python /home/debian/eme/myprog.py
[Install]
WantedBy=multi-user.target
服务文件位于以下两个位置:/ etc / systemd / system /和/ lib / systemd / system /,因为我不确定它实际属于哪个位置。当然,我已经在互联网上花费了大量时间来寻找解决方案。这里只有成功的故事...。 我输入了以下内容:
sudo systemctl enable myprog.service: nothing special
sudo systemctl start myprog.service: service is not loaded properly.....
sudo systemctl status myprog.service: error (invalid argument), inactive (dead).
来自bash或QTerminal:行为相同。
请帮助我该怎么办。 亲切的问候, 哈克