Skip to content Skip to sidebar Skip to footer

OsX Python 3.5 Bad Interpreter: No Such File Or Directory

I am trying to run the following code from the terminal window. I am following the tutorial found on this website https://automatetheboringstuff.com/chapter6/ . The name of my fil

Solution 1:

I figured out my problem. I was not executing it in the terminal correctly. I was entering './pw.py' when I needed to enter 'python pw.py' in order for it to run the script. Thanks for the help.


Solution 2:

What you have done looks correct from a python perspective. the #! is called a shebang / shabang and it informs the OS what interpreter to call in order to execute this script.

So I would guess that Python is installed in a different location then what has been supplied. Remember when this is called the full path needs to be supplied. Try running which python to get the location of the interpreter and place that at line 1


Solution 3:

I started getting this error when running pip python command, this started happening after a system-wide change in $HOME path, which apparently broke some stuff like pip (the old $HOME path seems hardcoded somewhere in the python installation).

I fixed it by re-installing pip (following this):

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py

Post a Comment for "OsX Python 3.5 Bad Interpreter: No Such File Or Directory"