-1

I installed AWS with Python 3.11 in my PC. later I uninstalled Python 3.11 to use Python 3.10 but when I run aws --version it still shows Python 3.11.

enter image description here

When I run other commands like eb init it shows and error:

'eb' is not recognized as an internal or external command,operable program or batch file.

And even if I pip install awsebcli it gets installed in Python 3.10. How to fix this?

user3507584
  • 3,246
  • 5
  • 42
  • 66
  • Install `awscli` with the new python version and update the windows path – Paolo May 26 '23 at 20:07
  • You did not say what OS you are running the aws-cli tools under, but as @Paolo commented, the cli package or installer, includes an embedded copy of Python with all the libraries it requires, so you won't change anything by upgrading/downgrading the system Python, as that is not used by the cli tools. The cli tools use whatever version they included. – gview May 26 '23 at 20:14
  • 2
    Please see https://stackoverflow.com/questions/49937100/awscli-python-version-shows-2-7-instead-of-3-6-on-windows-7 The Windows version of the AWS CLI, that is installed via the .msi installer, comes with a bundled version of Python. You don't really need to care about what version the AWS CLI tool is reporting that it is using, as long as it works. – Mark B May 26 '23 at 20:14
  • Also, the `eb` CLI is a completely different tool from the `aws` CLI, and has to be installed separately https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html – Mark B May 26 '23 at 20:15
  • @MarkB it's not just the windows version, as linux packages do the same thing, and I would assume that MacOS does the same. – gview May 26 '23 at 20:16
  • @gview it depends on how they are installed, but yes if you don't install them via `pip` then they most likely come with a bundled version of Python. – Mark B May 26 '23 at 20:17
  • @MarkB You also picked up on the OP trying to use the elastic beanstalk cli, which I missed. So perhaps aws is a complete red herring. [Instructions for installation and configuration of the eb cli are here](https://github.com/aws/aws-elastic-beanstalk-cli-setup). – gview May 26 '23 at 20:20
  • Thanks guys, I found the solution is to add the python roaming filepath (besides the local filepath) to the PATH environment variable in Windows 10. See related question here https://stackoverflow.com/questions/41729006/unable-to-install-aws-elastic-beanstalk-cli-win10-python-3-6-pip-9-0-1 I will add the solution but thanks for putting me on the right track. – user3507584 May 26 '23 at 22:35

1 Answers1

0

The solution is based on this question. Basically both local and roaming filepaths to Python need to be added to the Windows environment variables.

Go to Start/Edit the system environment variables/Environment Variables... Once opened, select Path variable and Edit. Ensure both local and roaming python file paths are added. Eg:

C:\Users\Your_user_name\AppData\Local\Programs\Python\Python310\Scripts
C:\Users\Your_user_name\AppData\Roaming\Python\Python310\Scripts

Once both are included in the Path variable, run in the command prompt pip install awsebcli --upgrade --user. Check it is correctly installed with eb --version.

user3507584
  • 3,246
  • 5
  • 42
  • 66