Can't import annotations from __future__

前端 未结 1 1711
日久生厌
日久生厌 2021-01-17 08:25

When running the statement

from __future__ import annotations

I get the following error:

Traceback (most recent call last):         


        
相关标签:
1条回答
  • 2021-01-17 08:55

    Looking at your error traceback, it looks like you are using python 3.5. Is that the case?

    If so, then the error happens because according to PEP-563 the import of __future__ annotations is available starting with Python 3.7.

    I did not find any hints that this will be backported to previous versions, but I might have missed that.

    0 讨论(0)
提交回复
热议问题