簡體   English   中英

由於模塊 colorama,aws CLI 無法使用

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM