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

混江龙づ霸主 提交于 2019-12-01 09:44:07

问题


Alright, have been installing Google Assistant on my Windows 10 PC and have been met with multiple errors, the last of which I solved by going here: Google Assistant Installation on Python3.6 OSX

Now, I have everything installed, and want to test my mic and then start using the assistant. However, when I put in the commands

python -m googlesamples.assistant.audio_helpers 

and

python -m googlesamples.assistant

I get this error:

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

I've been trying to follow this guide: https://www.xda-developers.com/how-to-get-google-assistant-on-your-windows-mac-or-linux-machine/

Any help fixing this would be great! Thanks!


回答1:


As per version 0.3.0 of the SDK the gRPC samples are using a different auth helpers.

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

And you can launch the update gRPC sample with:

python -m googlesamples.assistant.grpc.pushtotalk

You should be able to follow the instructions from the SDK package and gRPC package page and explore the reference sample




回答2:


Try this command instead:

python -m googlesamples.assistant.grpc.audio_helpers

If you go to the following path you will notice that there is a directory named grpc inside assistant directory.

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

That is why you need to append .grpc next to assistant. And inside grpc directory you can see audio_helpers.py script.

To launch google assistant enter following command:

python -m googlesamples.assistant.grpc.pushtotalk



来源:https://stackoverflow.com/questions/44091251/when-installing-google-assistant-i-an-error-googlesamples-assistant-is-a-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!