我相信您运行的是Python2,而不是Python3。
您可以通过运行 which python 在命令行或代码中,通过:
which python
import sys print(sys.version_info)