简体   繁体   English

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

[英]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 ,但没有成功。

Option 1选项1

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 :如果这种方法对您不起作用,请尝试:

Option 2选项 2

  1. Go to https://www.python.org/ and use the GUI installer for your OS转到https://www.python.org/并使用适用于您的操作系统的 GUI 安装程序

  2. 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.

相关问题 获取 /bin/bash^M:错误的解释器:在 Dataproc 上运行初始化脚本后没有这样的文件或目录 - Getting /bin/bash^M: bad interpreter: No such file or directory after running initialisation script on Dataproc AWS Lambda Extension throws exit status 127 (/usr/bin/env: node: No such file or directory) - AWS Lambda Extension throws exit status 127 (/usr/bin/env: node : No such file or directory) GCS 数据流抛出错误 - FileNotFoundException(找不到此类文件或目录) - GCS Dataflow throws an error - FileNotFoundException(No such file or directory found) AWS Cognito 登录返回 Bad gateway 错误 - AWS Cognito Signin returning Bad gateway error 错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:'requirements.txt' 使用 AWS Lambda 和 Python 时 - ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' When using AWS Lambda and Python hadoop fs -ls s3://bucket 或 s3a://bucket 抛出“没有这样的文件或目录”错误 - hadoop fs -ls s3://bucket or s3a://bucket throws "No such file or directory" error 循环遍历压缩的 gzip 文件在第二次迭代时抛出“错误 [Errno 2] 没有这样的文件或目录:'part-r-00001.gz'” - Python - Loop through compressed gzip files throws "ERROR [Errno 2] No such file or directory: 'part-r-00001.gz'" at second iteration - Python AWS Timestream“不相等”比较抛出错误 - AWS Timestream "Not equal" comparison throws error aws elastic beanstalk 部署了我的应用程序,但在下一次部署时抛出错误 - aws elastic beanstalk deploys my app but on next deployments throws an error AWS cli 在复制大文件时抛出错误 - AWS cli throws error when copying large files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM