sashoalm
sashoalm

Reputation: 79487

Can AWS CLI be installed using Python2.7?

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.

The documentation states that I should add to PATH this:

%USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts

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?

Upvotes: 1

Views: 2950

Answers (2)

Daljit Sinz
Daljit Sinz

Reputation: 129

The best approach to get this done is

  1. Install pip
  2. pip Install awscli
  3. aws configure
  4. keys and identification keys access parameters

To Install PIP: need to update YUM Release version and then install python-pip

#yum install epel-release    
#yum install python-pip

Install AWSCLI:

#pip install awscli

Configure AWSCLI:

#aws configure
aws_access_key_id=<########>
aws_secret_access_key=<####################>
Default Region[None]: region=us-west-2
format[none]: json

you can find these configuration parameters later in file::

~/.ssh/aws/credentials

Upvotes: 1

sashoalm
sashoalm

Reputation: 79487

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

After that it works:

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

Although there is still this weird File association not found for extension .py error.

Edit: 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" %*

Upvotes: 2

Related Questions