3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MACに AWSCLIをインストールをしたら詰まったのでメモ

Last updated at Posted at 2019-04-07

2019/4/7 python3.7
MACにAWS CLIをインストールしたら詰まってしまったのでメモ

###インストール

$ pip install awscli --upgrade --user

###インストール確認

$ aws --version
-bash: aws: command not found

実行できなかった。
ドキュメントによるとpythonのあるディレクトリにインストールされるのでパスを通せとあるが、インストールされていなかった。
調査した結果pip show _パッケージ_でインストールしたパッケージの場所を確認できるとあったので確認。

$ pip show awscli
Name: awscli
Version: 1.16.140
Summary: Universal Command Line Environment for AWS.
Home-page: http://aws.amazon.com/cli/
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: $HOME/.local/lib/python3.7/site-packages
Requires: rsa, botocore, PyYAML, colorama, s3transfer, docutils
Required-by: 

確認した場所をbash_profileに追加後bash_profile読み直し

$HOME/.local/lib/python3.7/site-packages/shims:$PATH
source ~/.bash_profile

しかし、解決しなかった。インストール時のログを見直したら/Users/ユーザ名/.local/binとあったのでそこにパスを通したら解決した。なぜそこにインストールされたか不明わかる人教えてください。

$ pip install awscli --upgrade --user
Collecting awscli
  Downloading https://files.pythonhosted.org/packages/3d/41/f03fa1b10c7619262da75d34ce93067c9f0dc274dbd482200250319d9bef/awscli-1.16.140-py2.py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 154kB/s 
Collecting PyYAML<=3.13,>=3.10 (from awscli)
  Using cached https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz
Collecting botocore==1.12.130 (from awscli)
  Downloading https://files.pythonhosted.org/packages/21/80/6683916e9e1eaf867e09b81a6df6d7a2ba181e3095d2367c7a0f635ed1ed/botocore-1.12.130-py2.py3-none-any.whl (5.4MB)
    100% |████████████████████████████████| 5.4MB 125kB/s 
Collecting colorama<=0.3.9,>=0.2.5 (from awscli)
  Downloading https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Collecting s3transfer<0.3.0,>=0.2.0 (from awscli)
  Downloading https://files.pythonhosted.org/packages/d7/de/5737f602e22073ecbded7a0c590707085e154e32b68d86545dcc31004c02/s3transfer-0.2.0-py2.py3-none-any.whl (69kB)
    100% |████████████████████████████████| 71kB 178kB/s 
Collecting rsa<=3.5.0,>=3.1.2 (from awscli)
  Downloading https://files.pythonhosted.org/packages/e1/ae/baedc9cb175552e95f3395c43055a6a5e125ae4d48a1d7a924baca83e92e/rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 142kB/s 
Collecting docutils>=0.10 (from awscli)
  Using cached https://files.pythonhosted.org/packages/36/fa/08e9e6e0e3cbd1d362c3bbee8d01d0aedb2155c4ac112b19ef3cae8eed8d/docutils-0.14-py3-none-any.whl
Collecting urllib3<1.25,>=1.20; python_version >= "3.4" (from botocore==1.12.130->awscli)
  Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1; python_version >= "2.7" (from botocore==1.12.130->awscli)
  Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.12.130->awscli)
  Downloading https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
  Using cached https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115cccf1903441bba3cbadcfae7b678a20167347fa8ded34c/pyasn1-0.4.5-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore==1.12.130->awscli)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: PyYAML, urllib3, docutils, six, python-dateutil, jmespath, botocore, colorama, s3transfer, pyasn1, rsa, awscli
  Running setup.py install for PyYAML ... done
  The scripts pyrsa-decrypt, pyrsa-decrypt-bigfile, pyrsa-encrypt, pyrsa-encrypt-bigfile, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/Users/ユーザ名/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed PyYAML-3.13 awscli-1.16.140 botocore-1.12.130 colorama-0.3.9 docutils-0.14 jmespath-0.9.4 pyasn1-0.4.5 python-dateutil-2.8.0 rsa-3.4.2 s3transfer-0.2.0 six-1.12.0 urllib3-1.24.1
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

pip のオプションに --user をつけるとsite.USER_BASEにインストールされるらしい。
site.USER_BASEの確認方法は下記の通り。

import site
site.getuserbase()
'$HOME/.local'
3
2
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?