首页 > 解决方案 > pip install terraform_utils 失败

问题描述

尝试在 Mac 上的 python 2.7 上使用 pip 安装 terraform_utils。

ERROR: Command errored out with exit status 1:
 command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-p0O4_9/terraform-utils/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-p0O4_9/terraform-utils/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-30t_an
     cwd: /private/tmp/pip-install-p0O4_9/terraform-utils/
Complete output (6 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/tmp/pip-install-p0O4_9/terraform-utils/setup.py", line 8
    def read_file(path: Union[str, Path]) -> str:
                      ^
SyntaxError: invalid syntax
----------------------------------------

错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

任何人都可以帮助解决上述错误吗?无法弄清楚缺少什么!

标签: pythonmacospython-2.7terraform

解决方案


看起来您正在使用 Python2.7 运行此代码,但它仅受 Python 3.5+ 支持。此语法是指静态类型,更多信息在这里:

https://docs.python.org/3/library/typing.html


推荐阅读