可以使用Python2.7安装AWS CLI吗? [英] Can AWS CLI be installed using Python2.7?
问题描述
我使用python -m pip install awscli
从Python 2.7安装了AWS CLI.它似乎已安装,但是随后尝试运行aws
时,我得到了'aws' is not recognized as an internal or external command
.
I installed AWS CLI from Python 2.7 using python -m pip install awscli
. It seemed to install, but then when trying to run aws
, I get 'aws' is not recognized as an internal or external command
.
文档状态,我应该在PATH中添加以下内容:
The documentation states that I should add to PATH this:
%USERPROFILE%\ AppData \ Local \ Programs \ Python \ Python36 \ Scripts
%USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts
但这是针对Python3的. Python2的安装位置在哪里? %USERPROFILE%\AppData\Local\Programs\
中没有任何内容(我检查过).安装适用于Python2还是仅适用于Python3?
But this is for Python3. Where is it installed for Python2? There is nothing in %USERPROFILE%\AppData\Local\Programs\
(I checked). And does installation work for Python2 or only for Python3?
推荐答案
经过大量搜索,文件位于c:\Python27\Scripts\aws.cmd
.但这是aws.cmd
,而不是aws.exe
.因此,要使aws
起作用,您需要将其添加到PATH中:
After lots of searching, the file was located at c:\Python27\Scripts\aws.cmd
. But it was aws.cmd
, not aws.exe
. So to make aws
work, you need to add it to the 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
错误.
Although there is still this weird File association not found for extension .py
error.
从@zwer关于找不到扩展名.py的文件关联"的评论中,您需要从管理员cmd提示符下执行此操作:
From @zwer's comment about "File association not found for extension .py", you need to execute this from an administrator cmd prompt:
assoc .py=Python.File
ftype Python.File=c:\Python27\python.exe "%1" %*
这篇关于可以使用Python2.7安装AWS CLI吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!