简体   繁体   中英

aws CLI unable to be used due to module colorama

aI've installed AWS CLI and am trying to use it on Mac OS Sierra. It complains there is is no module colorama :

$ aws

Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 26, in <module>
    from awscli.formatter import get_formatter
  File "/Library/Python/2.7/site-packages/awscli/formatter.py", line 19, in <module>
    from awscli.table import MultiTable, Styler, ColorizedStyler
  File "/Library/Python/2.7/site-packages/awscli/table.py", line 18, in <module>
    import colorama
ImportError: No module named colorama

So I try to install it and it says the requirement is already satisfied:

$ sudo pip install colorama

The directory '/Users/danniu/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/danniu/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: colorama in /Users/danniu/Library/Python/2.7/lib/python/site-packages

Don't install Python modules with sudo . If you add the --user command line option, this will install the package into your home folder (which your user owns) and you won't need to use sudo .

If you want this to be default, you can create a pip.conf file with the following contents:

[install]
user = true

located where it should on your given operating system (on macOS Sierra it's located at $HOME/Library/Application Support/pip/pip.conf ).

The easiest solution to your problem is to run

$ pip install --upgrade --user awscli

as this will make sure you have all needed dependencies.

I've faced this issue on MacOS Sierra and below command solved the issue.

pip install --ignore-installed six --upgrade --user awscli

Read more about why to use --ignore-installed six on github issue raised for installing the awscli on mac . https://github.com/pypa/pip/issues/3165 .

Also read AWS Doc on how to install AWS CLI :-http://docs.aws.amazon.com/cli/latest/userguide/installing.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM