This documentation is for Version 1 of the Amazon CLI only. For documentation related to Version 2 of the Amazon CLI, see the Version 2 User Guide.
Install and Update the Amazon CLI version 1 in a virtual environment
You can avoid requirement version conflicts with other pip
packages by
installing version 1 of the Amazon Command Line Interface (Amazon CLI) in a virtual environment.
Topics
Prerequisites
-
Python 3.7 or later. For installation instructions, see the Downloading Python
page in Python's Beginner Guide. Warning
Python 2.7 was deprecated by the Python Software Foundation
on January 1, 2020. Starting with Amazon CLI version 1.20.0, a minimum version of Python 3.6 is required. In order to use the Amazon CLI version 1 with an older version of Python, you need to install an earlier version of the Amazon CLI version 1. To view the Amazon CLI version 1 Python version support matrix, see Python version requirements.
-
pip
orpip3
is installed.
Install and update the Amazon CLI version 1 in a virtual environment
-
Install
virtualenv
usingpip
.$
pip install --user virtualenv
-
Create a virtual environment and name it.
$
virtualenv
~/cli-ve
Alternatively, you can use the
-p
option to specify a version of Python other than the default.$
virtualenv -p
/usr/bin/python37
~/cli-ve
-
Activate your new virtual environment.
Linux or macOS
$
source
~/cli-ve
/bin/activateWindows
$
%USERPROFILE%\cli-ve
\Scripts\activateThe prompt changes to show that your virtual environment is active.
(cli-ve)~$
-
Install or update the Amazon CLI version 1 into your virtual environment.
(cli-ve)~$
pip install --upgrade awscli
-
Verify that the Amazon CLI version 1 is installed correctly.
$
aws --version
aws-cli/1.27.69 Python/3.11.2 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13
-
You can use the
deactivate
command to exit the virtual environment. Whenever you start a new session, you must reactivate the environment.
Troubleshooting Amazon CLI install and uninstall errors
If you come across issues after installing or uninstalling the Amazon CLI, see Troubleshoot Amazon CLI errors for troubleshooting steps. For the most relevant troubleshooting steps, see Command not found errors, The "aws --version" command returns a different version than you installed, and The "aws --version" command returns a version after uninstalling the Amazon CLI.