1
Systemd:在启动时运行Python脚本(virtualenv)
我有一个Python脚本,通常使用以下命令运行它: (environment) python run.py 我想在开始时运行此脚本。(我正在使用ubuntu)这是我的服务: [Unit] Description=My Script Service After=multi-user.target [Service] Type=idle ExecStart=/home/user/anaconda3/bin/python /home/user/space/run.py [Install] WantedBy=multi-user.target 顺便说一句,我无法运行此脚本,但是我可以运行不在环境中的任何脚本。如何在启动(virtualenv)时运行python脚本? sudo systemctl status user_sent ● user_sent.service - Mail Service Loaded: loaded (/lib/systemd/system/user_sent.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since xxxxx 16:30:20 MSK; 3s ago Process: 3713 ExecStart=/usr/bin/python run.py (code=exited, status=200/CHDIR) Main …