安装谷歌助手时,我收到错误信息“...googlesamples.assistant为一个包,无法直接执行...”

2024-05-16 04:50:17 发布

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

好吧,在我的Windows 10电脑上安装Google助手时遇到了多个错误,最后一个是我在这里解决的:Google Assistant Installation on Python3.6 OSX

现在,我已经安装了所有的东西,想测试我的麦克风,然后开始使用助手。但是,当我下达命令时

python -m googlesamples.assistant.audio_helpers 

以及

python -m googlesamples.assistant

我得到这个错误:

C:\Users\robmak3>python -m googlesamples.assistant
C:\Users\robmak3\AppData\Local\Programs\Python\Python36\python.exe: No 
module named googlesamples.assistant.__main__; 'googlesamples.assistant' is 
a package and cannot be directly executed

我一直在试着遵循这个指南:https://www.xda-developers.com/how-to-get-google-assistant-on-your-windows-mac-or-linux-machine/

任何帮助修复这个都太好了!谢谢!


Tags: 命令onwindows错误google助手installationaudio
2条回答

请改为使用此命令:

python -m googlesamples.assistant.grpc.audio_helpers

如果转到以下路径,您将注意到在助手目录中有一个名为grpc的目录。

C:\Users\%username%\appdata\local\programs\python\python36-32\lib\site-packages\googlesamples\assistant\

这就是为什么您需要在助手旁边附加.grpc。在grpc目录中可以看到audio_helpers.py脚本。

要启动google助手,请输入以下命令:

python -m googlesamples.assistant.grpc.pushtotalk

enter image description here

enter image description here

根据SDK的0.3.0版本,gRPC示例使用不同的身份验证帮助程序。

pip install --upgrade google-auth-oauthlib[tool]
google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

您可以使用以下命令启动更新gRPC示例:

python -m googlesamples.assistant.grpc.pushtotalk

您应该能够按照SDK packagegRPC package页面中的说明进行操作,并探索引用sample

相关问题 更多 >