![](/img/trans.png)
[英]Getting /bin/bash^M: bad interpreter: No such file or directory after running initialisation script on Dataproc
[英]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
,但沒有成功。
類型
brew uninstall awscli
然后
brew install awscli
將 python 更新到 3.9。 看看下面的帖子。
如果這種方法對您不起作用,請嘗試:
轉到https://www.python.org/並使用適用於您的操作系統的 GUI 安裝程序
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.