繁体   English   中英

AWS 抛出以下错误:“错误的解释器:没有这样的文件或目录”

[英]AWS throws the following error: "bad interpreter: No such file or directory"

我不知道我的系统有任何变化,但aws CLI 工具已停止工作。

$ aws-bash: /Users/user_name/Library/Python/3.7/bin/aws:/usr/local/opt/python/bin/
python3.7: bad interpreter: No such file or directory

我试过其他地方建议的brew reinstall awscli ,但没有成功。

选项1

类型

brew uninstall awscli

然后

brew install awscli

将 python 更新到 3.9。 看看下面的帖子。

如果这种方法对您不起作用,请尝试:

选项 2

  1. 转到https://www.python.org/并使用适用于您的操作系统的 GUI 安装程序

  2. pip3 install awscli

另一种选择是查看.bash_profile.zshrc ,查找如下所示的行:

export PATH=/Users/user_name/Library/Python/3.7/bin/:$PATH

尝试先评论它。 如果它对你有用 - 删除它。

这一行的作用是预先确定二进制文件的查找路径,这反过来又优先于 brew 安装。

另一种解决方案

# Reinstall awscli using your latest/current Python installation
brew reinstall awscli

# Overwrite the existing /usr/local/bin/aws with the new installation
brew link --overwrite awscli

您可能不需要重新安装 awscli,只需更新其 Python 路径即可。

检查安装了哪些 Python 版本:

ls /usr/bin/python*
# /usr/bin/python2    /usr/bin/python3    /usr/bin/python2.7  /usr/bin/python3.6

python3 -V
# Python 3.6.8

找到 aws 命令,并更新其 python 路径:

which aws
# ~/.local/bin/aws

vi ~/.local/bin/aws
#!/usr/bin/python3

尝试再次调用 aws:

$ aws
# usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]

我通过查看我的.bash_profile解决了这个问题。 有一个旧条目在更新 python 后失效。

只是为了以防万一有人也忘了先看明显的,就像我一样......;)

暂无
暂无

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

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