[英]AWS throws the following error: "bad interpreter: No such file or directory"
I'm not aware of anything on my system having changed, but the aws
CLI tool has stopped working.我不知道我的系统有任何变化,但
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
I've tried brew reinstall awscli
which is suggested elsewhere, but with no luck.我试过其他地方建议的
brew reinstall awscli
,但没有成功。
Type类型
brew uninstall awscli
Then然后
brew install awscli
update python to 3.9.将 python 更新到 3.9。 look in the following post.
看看下面的帖子。
If this approach does not work for you, then try :如果这种方法对您不起作用,请尝试:
Go to https://www.python.org/ and use the GUI installer for your OS转到https://www.python.org/并使用适用于您的操作系统的 GUI 安装程序
pip3 install awscli
Another option would be to look into .bash_profile
or .zshrc
, look for line that looks like this:另一种选择是查看
.bash_profile
或.zshrc
,查找如下所示的行:
export PATH=/Users/user_name/Library/Python/3.7/bin/:$PATH
Try commenting it first.尝试先评论它。 If it works for you - remove it.
如果它对你有用 - 删除它。
What this line does is prepending the lookup path for binaries, which in turn takes priority over brew installation.这一行的作用是预先确定二进制文件的查找路径,这反过来又优先于 brew 安装。
Another solution另一种解决方案
# 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
You probably don't need to reinstall awscli, but just update its Python path.您可能不需要重新安装 awscli,只需更新其 Python 路径即可。
Check which Python versions are installed:检查安装了哪些 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
Locate aws command, and update its python path:找到 aws 命令,并更新其 python 路径:
which aws
# ~/.local/bin/aws
vi ~/.local/bin/aws
#!/usr/bin/python3
Try to call aws again:尝试再次调用 aws:
$ aws
# usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
I solved this issue by reviewing my .bash_profile
.我通过查看我的
.bash_profile
解决了这个问题。 There was an old entry which got invalid after updating python.有一个旧条目在更新 python 后失效。
Just for the case someone also forgot to look the obvious first, like me... ;)只是为了以防万一有人也忘了先看明显的,就像我一样......;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.