[英]aws CLI unable to be used due to module colorama
我已经安装了 AWS CLI 并尝试在 Mac OS Sierra 上使用它。 它抱怨没有模块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
所以我尝试安装它,它说要求已经满足:
$ 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
不要使用sudo
安装 Python 模块。 如果您添加--user
命令行选项,这会将软件包安装到您的主文件夹(您的用户拥有)中,您将不需要使用sudo
。
如果您希望这是默认设置,您可以创建一个pip.conf
以下内容的pip.conf
文件:
[install]
user = true
位于您给定的操作系统上应位于的位置(在 macOS Sierra 上,它位于$HOME/Library/Application Support/pip/pip.conf
)。
解决您问题的最简单方法是运行
$ pip install --upgrade --user awscli
因为这将确保您拥有所有需要的依赖项。
我在 MacOS Sierra 上遇到过这个问题,下面的命令解决了这个问题。
pip install --ignore-installed six --upgrade --user awscli
阅读有关在 mac 上安装 awscli引发的 github 问题上为什么要使用--ignore-installed six
更多信息。 https://github.com/pypa/pip/issues/3165 。
另请阅读有关如何安装 AWS CLI 的 AWS 文档:-http://docs.aws.amazon.com/cli/latest/userguide/installing.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.