Which python are you targeting?
Did you install it with brew? It uses a different path.
which python3 or
Choose the one you want
Copy that output
Paste it at the top of your python file
#! in front of that path so it looks something like
Make sure to change the file permissions
chmod +x filename
Put that file in a folder that is in your path
Not sure if your folder is in your path?
How to add that folder to your path?
Find your path first
If you are using bash or zsh you might have something like this
~/.zshrc at the bottom of your file
Consider removing the
.py from your file bc it is not needed in this case
Close and open your terminal, which is sourcing your file by its path
And now you should be able to treat your python file similar to a bash command
You don't need to use
python3 filename.py to run the file, you can just use
From anywhere on your filesystem!