我的不和谐机器人有一个小问题。我有一个systemd设置,但是每次启动它都会给我一个错误代码1. ImportError:没有名为“ discord”的模块。虽然我已经安装了discord.py。 错误:
● bot.service - Discord Bot
Loaded: loaded (/lib/systemd/system/bot.service; enabled; vendor preset:
enabled)
Active: failed (Result: exit-code) since Thu 2018-11-08 16:39:16 UTC; 8s ago
Process: 3843 ExecStart=/usr/bin/python3.5 /home/pi/luigi-bot/bot.py
(code=exited, status=1/FAILURE)
Main PID: 3843 (code=exited, status=1/FAILURE)
Nov 08 16:39:16 raspberrypi systemd[1]: Started Discord Bot.
Nov 08 16:39:16 raspberrypi python3.5[3843]: Traceback (most recent call
last):
Nov 08 16:39:16 raspberrypi python3.5[3843]: File "/home/pi/luigi-
bot/bot.py", line 3, in <module>
Nov 08 16:39:16 raspberrypi python3.5[3843]: import discord
Nov 08 16:39:16 raspberrypi python3.5[3843]: ImportError: No module named
'discord'
Nov 08 16:39:16 raspberrypi systemd[1]: bot.service: Main process exited,
code=exited, status=1/FAILURE
Nov 08 16:39:16 raspberrypi systemd[1]: bot.service: Unit entered failed
state.
Nov 08 16:39:16 raspberrypi systemd[1]: bot.service: Failed with result
'exit-code'.
bot.service文件:
[Unit]
Description=Discord Bot
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/python3.5 /home/pi/luigi-bot/bot.py
Restart=on-abort
[Install]
WantedBy=multi-user.target