gpt4 book ai didi

python - 由于模块 colorama 而无法使用 aws CLI

转载 作者:太空狗 更新时间:2023-10-30 00:38:27 29 4
gpt4 key购买 nike

a我已经安装了 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 文件:

[install]
user = true

位于给定操作系统上它应该位于的位置(在 macOS Sierra 上它位于 $HOME/Library/Application Support/pip/pip.conf)。

解决问题最简单的方法是运行

$ pip install --upgrade --user awscli

因为这将确保您拥有所有需要的依赖项。

关于python - 由于模块 colorama 而无法使用 aws CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43022227/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com