我怎样才能在我所有的启动中运行助手演示?

2024-04-28 23:05:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在我的语音套件V1中构建Google助手,并希望它在启动时做出响应。但我在现实生活中遇到了困难。 作为Linux和Raspberry Pi的新手,现在我不知道该怎么办了

一开始,我遵守了所有的官方指示。这很简单,我成功地在~/AIY-projects-python/src/examples/voice中运行了演示

然后我试着让它在系统启动时运行,只需在/etc/systemd/system中生成assist.service文件,它包含以下内容:

[Unit]
Description=Assist @ reboot
Wants=network-online.target
After=network-online.target
Wants=systemd-timesyncd.service
After=systemd-timesyncd.service

[Service]
Environment=DISPLAY=:0
Type=simple
Restart=always
User=pi
ExecStart=/usr/bin/python3 -u /home/pi/AIY-projects-python/src/examples/voice/main.py --language en-US

[Install]
WantedBy=multi-user.target

我创建了文件main.py$ cp assistant_library_with_button_demo.py main.py 然后我让它启用:

$ sudo systemctl enable assist.service

最后,我兴奋地重新启动了它。但两人的回答都是“好吧,谷歌!”也不是通过点击按钮

感觉有点不对劲,我在终端上打了这个:

$ sudo systemctl status assist.service

我发现错误代码是:

google.auth.exceptions.TransportError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75b4af70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

我甚至不能理解错误代码的确切含义。我需要别人的建议。请帮帮我


Tags: 文件pysrctargetmainservicenetworkexamples