有没有办法在Colaboratory中导入__future__

问题描述 投票:0回答:1

我想在Colaboratory上运行一个Python程序。它使用PyCharm成功运行,但它需要__future__。当我在Colaboratory上尝试时,我得到了这个错误。

    from __future__ import annotations
                                      ^
SyntaxError: future feature annotations is not defined

关于如何在Colaboratory进口__future__的任何建议?

谢谢。

python google-colaboratory
1个回答
1
投票

__future__存在。那个特殊的__future__功能没有。 Google Colaboratory目前使用的是Python 3.6,from __future__ import annotations是3.7。

如果你需要Python 3.7,你将不得不等待。

© www.soinside.com 2019 - 2024. All rights reserved.