AWS throws the following error: "bad interpreter: No such file or directory"
Solution 1
Option 1
Type
brew uninstall awscli
Then
brew install awscli
update python to 3.9. look in the following post.
If this approach does not work for you, then try :
Option 2
-
Go to https://www.python.org/ and use the GUI installer for your OS
-
pip3 install awscli
Solution 2
Another option would be to look into .bash_profile
or .zshrc
, look for line that looks like this:
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.
Solution 3
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
Solution 4
I solved this issue by reviewing my .bash_profile
. There was an old entry which got invalid after updating python.
Just for the case someone also forgot to look the obvious first, like me... ;)
kris
I've worked as a professional software developer in Australia, England, and Holland. I’ve also volunteered my skills with NGO’s in Africa and Asia. In 2011 I started the mobile app development business CoCreations.
Updated on June 04, 2022Comments
-
kris almost 2 years
I'm not aware of anything on my system having changed, but the
aws
CLI tool has stopped working.$ 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.-
jarmod over 3 yearsIf you edit
/Users/user_name/Library/Python/3.7/bin/aws
you'll presumably see that its shebang indicates/usr/local/opt/python/bin/python3.7
which no longer exists (either you deleted it or some automation deleted it).
-
-
kris over 3 yearsThanks - but this makes no difference -- even after following the prompts of the install which said to do
brew link awscli
andbrew link --overwrite awscli
-
BeeFriedman over 3 yearsYou also need to update to python 3.9. Look in to the post i linked above
-
BeeFriedman over 3 yearslook in the following post as well it says that you have to give permissions to the config file.
-
kris over 3 yearsI only saw the same install command when following that link - what is the specific command to update to python 3.9 please ?
-
BeeFriedman over 3 yearsyou could also use the GUI downloader from python.org
-
kris over 3 yearsThat did it @CForce99 -- installing python using the Mac installer, and then running
pip3 install awscli
(which then finally worked) -- THANK YOU !! OH - but now it turns out theaws
command I'm using needs the CLI v2 .. I'll follow the instructions it's giving me there and hopefully get to the end... -
Pateta over 3 yearsPlease note that "$" is missing in ":$PATH". This will remove all your path from the current session. Do not put this into bash_profile or similar
-
Aleksandr K. over 3 years@Pateta, thank you. Edited answer to fix this.