0

I'm having issues running a .py script. The full error I get is zsh: ./flashimage.py: bad interpreter: /usr/bin/python: no such file or directory Below are details of my system and files. I see I have python installed but its looks like its looking for it in the wrong place (/usr/bin/python). How do I fix this? Please explain like I'm 5. I'm really bad at terminal stuff.

which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python

which pip /Library/Frameworks/Python.framework/Versions/2.7/bin/pip

type -a python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python

python is /usr/local/bin/python

python --version Python 2.7.18

  • 1
    The error message tells you _exactly_ what's wrong. The first line of `flashimage.py` says it's supposed to be interpreted with `/usr/bin/python`, but your `python` isn't at `/usr/bin`. – Charles Duffy Jul 20 '22 at 19:56
  • 1
    Open up `flashimage.py` in an editor, change `#!/usr/bin/python` to `#!/usr/bin/env python` and then the `PATH` will be used to find the interpreter. – Charles Duffy Jul 20 '22 at 19:57
  • How do I change that is my question? I'm not too familiar with terminal @CharlesDuffy – Brandon Dickerson Jul 20 '22 at 20:01
  • 1
    You don't need to use the terminal at all. It's a text file. Open it in whatever tool you use to edit text files (ideally a programmer's editor; things made to act as word processors can corrupt source code by injecting "smart quotes" and other such silliness, so stick to tools built for developers to use). If you use VS Code, use VS Code. If you use Sublime Text, use Sublime Text. Etc. _Personally_ my favorite graphical programmer's editor on MacOS is MacVim, but you aren't bound to that; use whatever works for you. – Charles Duffy Jul 20 '22 at 22:56

0 Answers0