0

在尝试运行示例时,设法完成了大部分安装,直到结束。

python -m googlesamples.assistant.auth_helpers --client-secrets /home/pi/client_secret.json

Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 151, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/usr/lib/python3.4/runpy.py", line 118, in _get_module_details
return _get_module_details(pkg_main_name)
File "/usr/lib/python3.4/runpy.py", line 104, in _get_module_details
spec = importlib.util.find_spec(mod_name)
File "/usr/lib/python3.4/importlib/util.py", line 86, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
File "/home/pi/google/lib/python3.4/site-packages/googlesamples/assistant/auth_helpers/__init__.py", line 21, in <module>
import google.auth.transport.grpc
File "/home/pi/google/lib/python3.4/site-packages/google/auth/transport/grpc.py", line 20, in <module>
import grpc
File "/home/pi/google/lib/python3.4/site-packages/grpc/__init__.py", line 37, in <module>
from grpc._cython import cygrpc as _cygrpc
File "src/python/grpcio/grpc/_cython/cygrpc.pyx", line 32, in init grpc._cython.cygrpc (src/python/grpcio/grpc/_cython/cygrpc.c:28305)
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3036, in <module>
@_call_aside
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3020, in _call_aside
f(*args, **kwargs)
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3064, in _initialize_master_working_set
for dist in working_set
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3064, in <genexpr>
for dist in working_set
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2594, in activate
declare_namespace(pkg)
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2162, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/pi/google/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2097, in _handle_ns
loader.load_module(packageName)
File "./google.py", line 42
print head,body,tail

SyntaxError: Missing parentheses in call to 'print'

看到一个例子,其中一些人已经成功了,但我不清楚他们使用的是 python2 还是 3 venv?有人可以帮忙吗?

4

2 回答 2

1

看起来您在与python 命名空间包google.py冲突的同一目录中命名了一个文件。google.*

于 2017-05-19T05:02:27.783 回答
0

请参阅上面的评论中的@proppy 回复。本来会早点关门的,但我只收到了答案通知,但没有收到评论???

于 2017-05-23T14:28:38.610 回答