无法在Mac上安装AWS CLI

时间:2019-06-09 04:11:29

标签: python-3.x amazon-web-services aws-cli

我无法在MacBook Yosemite上安装AWS CLI。

AWS文档中的sudo命令出现错误。

我最初使用默认的python2.7安装了sudo,然后尝试使用python3.7进行安装,但是它不起作用。我觉得这是文件夹路径不正确,但是我不知道要检查什么。

我可以得到一些指导吗?

以下是错误输出:

MacBks-MBP:~ MacBkyosemite$ sudo /usr/local/bin/python3.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Password:
Running cmd: /usr/local/bin/python3.7 virtualenv.py --no-download --python /usr/local/bin/python3.7 /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-cache-dir --no-index --find-links file:///Users/MacBkyosemite/awscli-bundle/packages/setup setuptools_scm-1.15.7.tar.gz
Traceback (most recent call last):
  File "awscli-bundle/install", line 162, in <module>
    main()
  File "awscli-bundle/install", line 151, in main
    pip_install_packages(opts.install_dir)
  File "awscli-bundle/install", line 114, in pip_install_packages
    pip_script, setup_requires_dir, package
  File "awscli-bundle/install", line 49, in run
    p.returncode, cmd, stdout + stderr))
__main__.BadRCError: Bad rc (1) for cmd '/usr/local/aws/bin/pip install --no-cache-dir --no-index --find-links file:///Users/MacBkyosemite/awscli-bundle/packages/setup setuptools_scm-1.15.7.tar.gz': b'Traceback (most recent call last):\n  File "/usr/local/aws/bin/pip", line 7, in <module>\n    from pip import main\nImportError: cannot import name \'main\' from \'pip\' (/Users/MacBkyosemite/Library/Python/3.7/lib/python/site-packages/pip/__init__.py)\n'

MacBks-MBP:~ MacBkyosemite$ python3 --version
Python 3.7.3

MacBks-MBP:~ MacBkyosemite$ pip3 --version
pip 19.1.1 from /Users/MacBkyosemite/Library/Python/3.7/lib/python/site-packages/pip (python 3.7)

MacBks-MBP:~ MacBkyosemite$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3

1 个答案:

答案 0 :(得分:0)

要在Mac上安装AWS Command Line Interface,只需运行:

sudo pip3 install awscli

提示:通常,在安装Python库时使用虚拟环境是一个好主意,以避免冲突。在这种情况下,请启动虚拟环境,然后运行pip