简体   繁体   English

由于模块 colorama,aws CLI 无法使用

[英]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.我已经安装了 AWS CLI 并尝试在 Mac OS Sierra 上使用它。 It complains there is is no module colorama :它抱怨没有模块colorama

$ aws $ 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 $ 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 .不要使用sudo安装 Python 模块。 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 .如果您添加--user命令行选项,这会将软件包安装到您的主文件夹(您的用户拥有)中,您将不需要使用sudo

If you want this to be default, you can create a pip.conf file with the following contents:如果您希望这是默认设置,您可以创建一个pip.conf以下内容的pip.conf文件:

[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 ).位于您给定的操作系统上应位于的位置(在 macOS Sierra 上,它位于$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.我在 MacOS Sierra 上遇到过这个问题,下面的命令解决了这个问题。

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 .阅读有关在 mac 上安装 awscli引发的 github 问题上为什么要使用--ignore-installed six更多信息。 https://github.com/pypa/pip/issues/3165 . 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另请阅读有关如何安装 AWS CLI 的 AWS 文档:-http://docs.aws.amazon.com/cli/latest/userguide/installing.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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