Reputation: 1379
Via macOS' Terminal, trying to install and configure AWS CLI on macOS Sierra 10.12.6 to use Python 3.6.2 instead of macOS' default, Python 2.7.10.
Although I rigorously followed AWS' instructions (http://docs.amazonaws.cn/en_us/cli/latest/userguide/cli-install-macos.html), including configuring ./bash_profile thus:
# Setting PATH for Python 3.6.x
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
and double-checking via **echo $PATH**
PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
When executing
$ aws --version
the result is always this:
aws-cli/1.10.60 Python/2.7.10 Darwin/16.7.0 botocore/1.4.50
Thank you in advance for any suggestions as to how to configure AWS CLI to ignore Python 2.7.10 and execute via Python 3.6.x.
Upvotes: 8
Views: 8341
Reputation: 259
I faced the same issue. Instead of fixing it, I altered my path and installed with brew. It was seamless and the fastest solution.
$brew install awscli
Then,
$aws --version
Upvotes: 1
Reputation: 21
I was able to get it work by doing this
export PATH=~/.local/bin:~/Library/Python/3.6/bin:$PATH
pip3 install awscli
Upvotes: 0
Reputation: 1395
In my case, I solved this problem via followings.
$ pip3 --version
pip 18.1 from {....} (python 3.6)
$ export PATH=~/.local/bin:~/Library/Python/3.6/bin:$PATH
$ pip3 install awscli --upgrade # without --user
$ aws --version
aws-cli/1.16.22 Python/3.6.5 Darwin/18.2.0 botocore/1.12.12
Upvotes: 9
Reputation: 13016
It sounds like you may have the awscli
installed twice under different versions of Python, and the version installed on System Python is taking precedence.
Try running both of these commands and see if it shows up in both:
$ pip3 freeze | grep awscli
Then:
$ pip2 freeze | grep awscli
If it's listed in the latter, then run:
$ pip2 uninstall awscli
With a fresh install today, this is the output I get:
$ aws --version
aws-cli/1.11.162 Python/3.6.2 Darwin/15.6.0 botocore/1.7.20
I'm not very familiar with how AWS recommends installing Python on macOS, but the most flexible way in my opinion is to install pyenv
via brew
then manage your Python versions through pyenv. This allows you the flexibility of having multiple subversions of Python 2 and Python 3 installed simultaneously, as well as System Python. I would recommend this approach here as well.
Upvotes: 2
Reputation: 3135
How did you install awscli
? Did you use pip that comes with Python 3?
Check which pip you're using and use the one for Python 3 to install awscli.
Upvotes: 0