![](https://csdnimg.cn/release/download_crawler_static/12475021/bg14.jpg)
AWS Command Line Interface 用户指南
在虚拟环境中安装 AWS CLI
$ aws --version
aws-cli/1.17.4 Python/3.7.4 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13
$ pip3 list -o
Package Version Latest Type
---------- -------- -------- -----
awscli 1.16.170 1.16.198 wheel
botocore 1.12.160 1.12.188 wheel
由于前一个命令显示有较新版本的 AWS CLI 可用,您可以运行 pip3 install --upgrade 以获取最新版
本。
$ pip3 install --upgrade --user awscli
Collecting awscli
Downloading https://files.pythonhosted.org/packages/dc/70/
b32e9534c32fe9331801449e1f7eacba6a1992c2e4af9c82ac9116661d3b/awscli-1.16.198-py2.py3-none-
any.whl (1.7MB)
|████████████████████████████████| 1.7MB 1.6MB/s
Collecting botocore==1.12.188 (from awscli)
Using cached https://files.pythonhosted.org/packages/10/
cb/8dcfb3e035a419f228df7d3a0eea5d52b528bde7ca162f62f3096a930472/botocore-1.12.188-py2.py3-
none-any.whl
Requirement already satisfied, skipping upgrade: docutils>=0.10 in ./venv/lib/python3.7/
site-packages (from awscli) (0.14)
Requirement already satisfied, skipping upgrade: rsa<=3.5.0,>=3.1.2 in ./venv/lib/
python3.7/site-packages (from awscli) (3.4.2)
Requirement already satisfied, skipping upgrade: colorama<=0.3.9,>=0.2.5 in ./venv/lib/
python3.7/site-packages (from awscli) (0.3.9)
Requirement already satisfied, skipping upgrade: PyYAML<=5.1,>=3.10; python_version !=
"2.6" in ./venv/lib/python3.7/site-packages (from awscli) (3.13)
Requirement already satisfied, skipping upgrade: s3transfer<0.3.0,>=0.2.0 in ./venv/lib/
python3.7/site-packages (from awscli) (0.2.0)
Requirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in ./venv/lib/
python3.7/site-packages (from botocore==1.12.188->awscli) (0.9.4)
Requirement already satisfied, skipping upgrade: urllib3<1.26,>=1.20; python_version >=
"3.4" in ./venv/lib/python3.7/site-packages (from botocore==1.12.188->awscli) (1.24.3)
Requirement already satisfied, skipping upgrade: python-dateutil<3.0.0,>=2.1;
python_version >= "2.7" in ./venv/lib/python3.7/site-packages (from botocore==1.12.188-
>awscli) (2.8.0)
Requirement already satisfied, skipping upgrade: pyasn1>=0.1.3 in ./venv/lib/python3.7/
site-packages (from rsa<=3.5.0,>=3.1.2->awscli) (0.4.5)
Requirement already satisfied, skipping upgrade: six>=1.5 in ./venv/lib/python3.7/site-
packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore==1.12.188-
>awscli) (1.12.0)
Installing collected packages: botocore, awscli
Found existing installation: botocore 1.12.160
Uninstalling botocore-1.12.160:
Successfully uninstalled botocore-1.12.160
Found existing installation: awscli 1.16.170
Uninstalling awscli-1.16.170:
Successfully uninstalled awscli-1.16.170
Successfully installed awscli-1.16.198 botocore-1.12.188
在虚拟环境中安装 AWS CLI
如果您在尝试随 pip3 一起安装 AWS CLI 时遇到问题,可以在虚拟环境中安装 AWS CLI (p. 30) 来隔离
工具及其依赖项。或者,您可以使用与通常不同的 Python 版本。
安装后需要执行的步骤
• 设置路径以包含 AWS CLI (p. 16)
15