

**This documentation is for Version 1 of the AWS CLI only.**

We announced the upcoming end-of-support for the AWS CLI version 1. We recommend that you migrate to the AWS CLI version 2. For dates, additional details, and information on how to migrate, see the [announcement](https://aws.amazon.com/blogs/developer/cli-v1-maintenance-mode-announcement/). For documentation related to Version 2 of the AWS CLI, see the [Version 2 User Guide](https://docs.aws.amazon.com/cli/latest/userguide/).

# Installing and updating the AWS CLI version 1 in a virtual environment
<a name="install-virtualenv"></a>

You can avoid requirement version conflicts with other `pip` packages by installing version 1 of the AWS Command Line Interface (AWS CLI) in a virtual environment.

**Topics**
+ [Prerequisites](#install-virtualenv-prereqs)
+ [Install and update the AWS CLI version 1 in a virtual environment](#install-virtualenv-install)
+ [Troubleshooting AWS CLI install and uninstall errors](#install-virtualenv-tshoot)

## Prerequisites
<a name="install-virtualenv-prereqs"></a>
+ Python 3.8 or later. For installation instructions, see the [Downloading Python](https://wiki.python.org/moin/BeginnersGuide/Download) page in Python's *Beginner Guide*.

  **Python version support matrix**    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/cli/v1/userguide/install-virtualenv.html)
+ `pip` or `pip3` is installed.

## Install and update the AWS CLI version 1 in a virtual environment
<a name="install-virtualenv-install"></a>

1. Install `virtualenv` using `pip`.

   ```
   $ pip install --user virtualenv
   ```

1. 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
   ```

1. Activate your new virtual environment.

   **Linux or macOS**

   ```
   $ source ~/cli-ve/bin/activate
   ```

   **Windows**

   ```
   $ %USERPROFILE%\cli-ve\Scripts\activate
   ```

   The prompt changes to show that your virtual environment is active.

   ```
   (cli-ve)~$
   ```

1. Install or update the AWS CLI version 1 into your virtual environment.

   ```
   (cli-ve)~$ pip install --upgrade awscli
   ```

1. Verify that the AWS CLI version 1 is installed correctly.

   ```
   $ aws --version
   aws-cli/1.40.41 Python/3.11.6 Linux/5.10.205-195.807.amzn2.x86_64 botocore/1.18.6
   ```

1. You can use the `deactivate` command to exit the virtual environment. Whenever you start a new session, you must reactivate the environment.

## Troubleshooting AWS CLI install and uninstall errors
<a name="install-virtualenv-tshoot"></a>

If you come across issues after installing or uninstalling the AWS CLI, see [Troubleshooting errors for the AWS CLI](cli-chap-troubleshooting.md) for troubleshooting steps. For the most relevant troubleshooting steps, see [Command not found errors](cli-chap-troubleshooting.md#tshoot-install-not-found), [The "`aws --version`" command returns a different version than you installed](cli-chap-troubleshooting.md#tshoot-install-wrong-version), and [The "`aws --version`" command returns a version after uninstalling the AWS CLI](cli-chap-troubleshooting.md#tshoot-uninstall-1).