我想运行一个 python 脚本,它使用 virtualenv 作为服务。我已经研究了一些,但找不到可行的解决方案。我已将虚拟环境 python 的路径放在 python 的第一行。该服务如下所示:
[Unit]
Description=Telegram Bot Service
After=multi-user.target
[email protected]
[Service]
Type=simple
ExecStart=/usr/bin/python3.7 /home/pi/github/python/telegrambot.py
StandardInput=tty-force
[Install]
WantedBy=multi-user.target
错误:
● telegrambot.service - Telegram Bot Service
Loaded: loaded (/lib/systemd/system/telegrambot.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-03-03 15:04:11 GMT; 3s ago
Process: 15090 ExecStart=/usr/bin/python3.7 /home/pi/github/python/telegrambot.py (code=ex
Main PID: 15090 (code=exited, status=1/FAILURE)
Mar 03 15:04:11 raspberrypi systemd[1]: Started Telegram Bot Service.
Mar 03 15:04:11 raspberrypi systemd[1]: telegrambot.service: Main process exited, code=exite
Mar 03 15:04:11 raspberrypi systemd[1]: telegrambot.service: Failed with result 'exit-code'.
感谢您提前提供任何帮助!