我正在做一个没有监视器的对象项目,我为此选择了 ststemd,但出现了错误

我正在做一个没有监视器的对象项目,我为此选择了 ststemd,但出现了错误
[Unit]
Description=object
After=network.target

[Service]
ExecStart=/usr/bin/python3 /home/pi/raspberry_pi/test.py
Restart=always
User=pi
[Install]
WantedBy=multi-user.target

这是代码。当我手动启动它并查看状态时,我得到了这个

● object.service - object
     Loaded: loaded (/etc/systemd/system/object.service; enabled; vendor preset>
     Active: failed (Result: exit-code) since Wed 2023-02-22 16:18:40 IST; 8s a>
    Process: 2170 ExecStart=/usr/bin/python3 /home/pi/raspberry_pi/test.py (cod>
   Main PID: 2170 (code=exited, status=1/FAILURE)
        CPU: 1.520s

Feb 22 16:18:40 raspberrypi systemd[1]: object.service: Consumed 1.520s CPU tim>
Feb 22 16:18:40 raspberrypi systemd[1]: object.service: Scheduled restart job, >
Feb 22 16:18:40 raspberrypi systemd[1]: Stopped object.
Feb 22 16:18:40 raspberrypi systemd[1]: object.service: Consumed 1.520s CPU tim>
Feb 22 16:18:40 raspberrypi systemd[1]: object.service: Start request repeated >
Feb 22 16:18:40 raspberrypi systemd[1]: object.service: Failed with result 'exi>
Feb 22 16:18:40 raspberrypi systemd[1]: Failed to start object.

请提供一些建议

相关内容