Getting SyntaxError: future feature google_type_annotations is not defined

Getting SyntaxError: future feature google_type_annotations is not defined

我是 运行 python 3.7.5。该行:

from __future__ import google_type_annotations

抛出以下错误:

SyntaxError: future feature google_type_annotations is not defined

另一个 S/O post here 指出了这个问题 - 评论暗示安装 pytype 可以解决问题。

-- 我安装了pytype,但是问题依旧。

我也从这个网站上简单看了下这些日志:https://aur.archlinux.org/packages/google-cloud-sdk/?O=10&PP=10, which mentions the problem in passing and led me to https://issuetracker.google.com/issues/146012762。如何解决?

环顾四周,这似乎是 Google 发布的补丁中的一项功能,用于向后移植 Python 3 样式类型注释到旧版本的 Python。如果您已经 运行 是 Python 3.

的一个版本,那么从您的代码中删除该行应该是安全的