【问题标题】:Getting SyntaxError: future feature google_type_annotations is not defined获取 SyntaxError:未定义未来功能 google_type_annotations
【发布时间】:2021-03-05 09:02:49
【问题描述】:

我正在运行 python 3.7.5。行:

from __future__ import google_type_annotations

抛出以下错误:

SyntaxError: future feature google_type_annotations is not defined

另一个 S/O 帖子 here 指出了这个问题 - cmets 暗示安装 pytype 将解决这个问题。

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

我还简要查看了来自该网站的这些日志:https://aur.archlinux.org/packages/google-cloud-sdk/?O=10&PP=10,其中顺便提到了问题并引导我访问https://issuetracker.google.com/issues/146012762。如何解决?

【问题讨论】:

    标签: python python-3.x syntax-error


    【解决方案1】:

    环顾四周,这似乎是 Google 发布的补丁中的一项功能,用于将 Python 3 样式类型注释向后移植到旧版本的 Python。如果您已经在运行 Python 3 版本,那么从代码中删除该行应该是安全的。

    【讨论】:

    • 看来这个错误实际上是从我的gin-config 安装中抛出的。我不妨在那里打开一个问题。
    • 虽然不是永久修复,但我在再次构建杜松子酒之前深入研究了源代码并注释掉了有问题的导入。它现在似乎工作正常:)
    猜你喜欢
    • 1970-01-01
    • 2014-07-21
    • 2020-09-22
    • 2015-09-30
    • 2020-03-12
    • 2018-10-19
    • 2016-10-29
    • 1970-01-01
    • 2022-06-30
    相关资源
    最近更新 更多