这个新的 Python 语法叫什么?
What is this new Python syntax called?
我正在处理来自 Github 的一些安装脚本,并且我正在尝试执行 this script,由于这些行,它看起来像失败了:
current_app: 'PillarServer' = LocalProxy(_get_current_app)
"""the current app, annotated as PillarServer"""
用 Python 3.5 执行它 returns 这个错误:
$python main.py
File "main.py", line 33
current_app: 'PillarServer' = LocalProxy(_get_current_app)
^
SyntaxError: invalid syntax
有人可以帮我一下吗?我不是 Python 方面的专家,但被迫使用此脚本。
这是一个 PEP-526 风格的变量注解。您似乎是 运行 旧版本 Python 的代码;您需要使用 Python 3.6 或更高版本才能识别该语法。
我正在处理来自 Github 的一些安装脚本,并且我正在尝试执行 this script,由于这些行,它看起来像失败了:
current_app: 'PillarServer' = LocalProxy(_get_current_app)
"""the current app, annotated as PillarServer"""
用 Python 3.5 执行它 returns 这个错误:
$python main.py
File "main.py", line 33
current_app: 'PillarServer' = LocalProxy(_get_current_app)
^
SyntaxError: invalid syntax
有人可以帮我一下吗?我不是 Python 方面的专家,但被迫使用此脚本。
这是一个 PEP-526 风格的变量注解。您似乎是 运行 旧版本 Python 的代码;您需要使用 Python 3.6 或更高版本才能识别该语法。