# pyenvでインストールするとビルドがこける
$ pyenv install 3.7.3
...
BUILD FAILED (OS X 10.14.4 using python-build 1.2.11)
...
# https://github.com/pyenv/pyenv/wiki/Common-build-problems
# 上記を参考にインストールし直す
$ brew install readline xz
# なにやら忠告される
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
# readlineのパスを通す
$ export LDFLAGS="-L/usr/local/opt/readline/lib"
$ export CPPFLAGS="-I/usr/local/opt/readline/include"
# Mojave以上だとコマンドラインツールのSDKヘッダを別にインストールしなくてはいけないとのこと
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
$ pyenv install 3.7.3
Installed Python-3.7.3 ...
$ pyenv global 3.7.3
$ exec $SHELL -l
$ python --version
Python 3.7.3
# pipのインストール
$ easy_install pip
[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-29104.pth'
$ sudo easy_install pip
# AWS CLIのインストール
$ pip install awscli
...
Successfully installed PyYAML-3.13 awscli-1.16.141 botocore-1.12.131 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
# python 2系だと次のエラーが出る
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: six, python-dateutil, botocore, futures, s3transfer, awscli
Found existing installation: six 1.4.1
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
# 対処としては
# sudo easy_install nose
# sudo easy_install tornado
# などをするが3系に上げたほうが早い
$ aws --version
aws-cli/1.16.141 Python/3.7.3 Darwin/18.5.0 botocore/1.12.131
# 設定
$ aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]: ap-northeast-1
Default output format [None]: text
# 疎通確認
$ aws ec2 describe-security-groups
SECURITYGROUPS default VPC security group
# アップデート
pip install -U awscli
# pipのアップグレード
pip install --upgrade pip