安装Google助手时报错“...googlesamples.assistant'是一个包,不能直接执行...”

When installing Google Assistant, I an error "...googlesamples.assistant' is a package and cannot be directly executed..."

好的,我已经在我的 Windows 10 PC 上安装了 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/

任何解决这个问题的帮助都会很棒!谢谢!

根据 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 package and gRPC package page and explore the reference sample

中的说明进行操作

试试这个命令:

python -m googlesamples.assistant.grpc.audio_helpers

如果你进入下面的路径你会发现在assistant目录下有一个名为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