我使用 python -m pip install awscli
从 Python 2.7 安装了 AWS CLI。它似乎可以安装,但是当尝试运行 aws
时,我得到 'aws' is not recognized as an internal or external command
。
documentation states我应该将此添加到 PATH 中:
%USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts
但这是针对 Python3 的。 Python2 安装在哪里? %USERPROFILE%\AppData\Local\Programs\
中没有任何内容(我检查过)。安装适用于 Python2 还是仅适用于 Python3?
最佳答案
经过大量搜索,该文件位于 c:\Python27\Scripts\aws.cmd
。但它是 aws.cmd
,而不是 aws.exe
。因此,要使 aws
正常工作,您需要将其添加到 PATH 中:
set PATH=%PATH%;c:\Python27\Scripts
之后就可以了:
c:\Python27>aws --version
File association not found for extension .py
aws-cli/1.11.148 Python/2.7.14rc1 Windows/10 botocore/1.7.6
尽管仍然存在这个奇怪的 File association not found for extension .py
错误。
编辑:根据@zwer 关于“未找到扩展名 .py 的文件关联”的评论,您需要从管理员 cmd 提示符执行此操作:
assoc .py=Python.File
ftype Python.File=c:\Python27\python.exe "%1" %*
关于windows - AWS CLI可以用Python2.7安装吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46112463/