在Mac OS上安装AWS EB CLI

10
我按照这里的说明进行操作:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html。pip install --upgrade --user awsebcli 运行得很好,但是当我键入 $ eb 命令时,它会显示“未找到命令”。

显然,我必须修改路径变量:

echo $SHELL. 结果显示:/bin/bash。

以下是修改步骤:

1) Find your shell's profile script in your user folder. If you are not sure which shell you have, run echo $SHELL.

$ ls -a ~
.  ..  .bash_logout  .bash_profile  .bashrc  Desktop  Documents  Downloads
Bash – .bash_profile, .profile, or .bash_login.
Zsh – .zshrc
Tcsh – .tcshrc, .cshrc or .login.

2) Add an export command to profile script.

export PATH=~/.local/bin:$PATH
This command adds a path, `~/.local/bin` in this example, to the current PATH variable.

3) Load the profile into your current session.

$ source ~/.bash_profile

这对我来说毫无意义:为什么我要运行$ ls -a ~?我已经运行了。
export PATH=~/.local/bin:$PATH

而且它并没有改变任何东西。3也是一样的。

请指导如何让eb工作。谢谢。

更新:echo $PATH给出了以下结果:

/Users/ME/bin/bash:/Users/ME/bin/bash.:/Users/ME/.local/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/mysql-5.7.11-osx10.9-x86_64/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/ME/.local/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/mysql-5.7.11-osx10.9-x86_64/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet


echo $PATH 输出什么? - helloV
请查看更新后的答案。 - Robert Brax
1
“~/.local/bin” 仅是示例。对于OSX,情况有所不同。请再次查看说明。我建议您只需执行“$ brew install awsebcli”,所有问题都会得到解决。 - helloV
1
谢谢,使用brew修复了它。你可以将此作为答案添加。为什么brew会处理这个问题而不是其他方式?在这些过程中,brew是否更加智能? - Robert Brax
3个回答

51

使用:

$ brew install awsebcli

在此处描述

Homebrew专为OSX设计,能够很好地处理依赖项。


3
  • If you are trying to install EB CLI for default python version on mac, you can simply use:

    $brew install awsebcli
    
  • If you are intending to install for python3, use pip3 to install and add export path to the bash profile as you mentioned. The path should be directed to the bin of python3 installed on your mac.

    Example:

    export PATH=~/Library/Python/3.7/bin:$PATH
    

更多详情请参见:https://medium.com/@stevo.perisic/installing-python3-pip-and-aws-cli-on-macos-sierra-ca23ff8ad651


0

对于Mac用户来说,最简单的方法是使用Homebrew。

brew install awsebcli

我使用的备选方案:

  1. 克隆这个代码库 使用以下命令:
git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
  1. 安装/升级 EB CLI MacOS/Linux 在 Bash 或 Zsh 上:
python ./aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py

Windows 在 PowerShell 或命令提示符窗口中:

python .\aws-elastic-beanstalk-cli-setup\scripts\ebcli_installer.py
  1. 安装完成后 在Linux和macOS上,输出包含指令以将EB CLI(和Python)可执行文件添加到shell的$PATH变量中,如果它还没有在其中。

3.1 使用方法 ebcli_installer.py Python脚本将在虚拟环境中安装awsebcli软件包,以防止与其他Python软件包发生潜在冲突。

对于大多数用例,您可以不带参数执行ebcli_installer.py脚本。

python ./aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py

更多信息可以在这里获取


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接