简体   繁体   English

如何卸载 aws-cli

[英]How to uninstall aws-cli

I am trying to set up an "Amazon Elastic Container Registry" but I get the following error when using this command: aws ecr get-login --no-include-email --region us-west-2 :我正在尝试设置“Amazon Elastic Container Registry”,但在使用此命令时出现以下错误: aws ecr get-login --no-include-email --region us-west-2

Unknown options: --no-include-email

The manual redirects me when this occurs to go to the following page, in order to update my aws cli.当 go 发生这种情况时,手册将我重定向到下一页,以便更新我的 aws cli。 https://docs.aws.amazon.com/cli/latest/userguide/installing.html https://docs.aws.amazon.com/cli/latest/userguide/installing.html

Which in short means, call pip install awscli --upgrade --user .简而言之,请致电pip install awscli --upgrade --user While that works, my cli is not updated.虽然可行,但我的 cli 没有更新。 So I removed it at all pip uninstall awscli .所以我完全删除了它pip uninstall awscli But I still had the aws command available, also when I opened a new session in the terminal...但是当我在终端中打开一个新的 session 时,我仍然可以使用aws命令...

So I assume I haven't installed my aws cli via pip, but I can not figure out how it does is installed.所以我假设我没有通过 pip 安装我的 aws cli,但我不知道它是如何安装的。 Can anyone help me out and give me some directions to resolve this issue.任何人都可以帮助我并给我一些解决这个问题的方向。 So I can remove the current awscli, and install a new version via pip install awscli --upgrade --user所以我可以删除当前的 awscli,并通过pip install awscli --upgrade --user安装新版本

I had a similar issue.我有一个类似的问题。 Answering in case someone else does too.回答以防万一其他人也这样做。 I think I had originally installed it without pip like this: https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html .我想我最初没有像这样安装它: https : //docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html So you just need to uninstall it like this (as instructed in above link):所以你只需要像这样卸载它(如上面的链接所示):

$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws

Then you can re-install it with pip3: https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html然后你可以用 pip3 重新安装它: https ://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html

Basically:基本上:

pip3 install awscli --upgrade --user

Then add it to your path然后将其添加到您的路径中

export PATH=/Users/yourname/Library/Python/3.6/bin/:$PATH

On ubuntu :在 Ubuntu 上:

sudo apt-get remove --auto-remove awscli

ln -s /home/ubuntu/.local/bin/aws /usr/bin/aws

卸载 awscli。

pip uninstall awscli -y

I had the same issue, but unlike Morgan, I prefer to use Homebrew to maintain all my dependencies in a single place.我遇到了同样的问题,但与 Morgan 不同,我更喜欢使用 Homebrew 在一个地方维护我的所有依赖项。

So what I did was:所以我所做的是:

1 - uninstall awscli (was installed with pip - python2) 1 - 卸载 awscli(使用 pip - python2 安装)

$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws

2 - Install awscli using homebrew 2 - 使用自制软件安装 awscli

$ brew install awscli

Homebrew will install awscli inside Cellar folder: /usr/local/Cellar/awscli Homebrew 将在 Cellar 文件夹中安装 awscli:/usr/local/Cellar/awscli

Note: I also have python3 installed through Hombrew.注意:我还通过 Hombrew 安装了 python3。

Links:链接:

If you are using mac and used brew to install aws cli.如果您使用的是 mac 并使用 brew 来安装 aws cli。 Use brew uninstall awscli and try brew install awscli使用brew uninstall awscli并尝试brew install awscli

First try to get the path of the installation by using this command in Linux or mac首先尝试在Linux或mac中使用此命令获取安装路径

which aws-cli

After you get the installation location try removing the directory by using获得安装位置后,请尝试使用以下命令删除目录

sudo rm -rf "/path resultant from previous command"
  1. Remove respective bin & config files:删除相应的 bin 和配置文件:
  • rm -rf /usr/local/bin/saml2aws rm -rf /usr/local/bin/saml2aws
  • rm -rf ~/.aws/config rm -rf ~/.aws/config
  • rm -rf ~/.aws/credentials rm -rf ~/.aws/credentials
  1. Reinstall using the 'install.sh' script使用“install.sh”脚本重新安装

In case if someone has installed aws-cli using Snap,then following method might be helpful :如果有人使用 Snap 安装了 aws-cli,那么以下方法可能会有所帮助:

First, open the Linux terminal and run the following command in it:首先,打开Linux终端并在其中运行以下命令:

sudo snap remove aws-cli sudo snap 删除 aws-cli

The basic command line to remove a snap package is删除 snap 包的基本命令行是

sudo snap remove < package > sudo snap remove <包>

You have to put the name of a specific application instead of < package > Once you execute the command successfully, the terminal will ask you to enter the [sudo] password you put for the installation, but if you don't have any password, press Enter to process it.您必须输入特定应用程序的名称而不是 <package> 一旦您成功执行命令,终端会要求您输入您为安装设置的 [sudo] 密码,但如果您没有任何密码,按 Enter 进行处理。

After completion of this procedure, you will see that aws-cli gets uninstalled from the system.完成此过程后,您将看到 aws-cli 从系统中卸载。 However, the folder of aws is still present in the snap folder, so execute the following command to remove it:但是snap文件夹中仍然存在aws的文件夹,执行如下命令删除:

sudo snap rm -r aws-cli sudo snap rm -r aws-cli

I tried this on linux and it seemed to work sudo yum erase awscli我在 linux 上试过这个,它似乎工作sudo yum erase awscli

and get me to a place where when I run:把我带到我跑步的地方:

aws --version
zsh: command not found: aws

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM