0

我有一个google aiyproject 语音工具包。我已经设置了身份验证,并且当脚本从终端运行时一切正常,例如./example.py. 我将相同的脚本配置为 systemctl 服务,启动时出现此错误。

Feb 26 20:27:47 raspberrypi python3[933]: To use the Assistant API, manually start the application from the dev terminal.
Feb 26 20:27:47 raspberrypi python3[933]: See the "Turn on the Assistant API" section of the Voice Recognizer
Feb 26 20:27:47 raspberrypi python3[933]: User's Guide for more info.

我在这里看到这段代码

  if not os.getenv('DISPLAY') and not sys.stdout.isatty():
        print("""
To use the Assistant API, manually start the application from the dev terminal.
See the "Turn on the Assistant API" section of the Voice Recognizer
User's Guide for more info.""")
        sys.exit(1)

我对python不太熟悉,想知道为什么它不能作为服务运行。身份验证令牌保存在文件中,无需交互。有没有办法我可以做到这一点。我的要求是在系统启动时,助手程序应该以无头模式自动启动。

4

0 回答 0