Starting with macOS 12.3.1, Apple removed the Python 2.7.18 distribution from the operating system. So, no reference to python will launch anything since /usr/bin/python no longer exists.
One of your options would be to install Python 2.7.18 (deprecated) from python.org which is X86_64 binary only that installs the following:
/Library/Frameworks/Python.framework/Versions/2.7
and binaries from this distribution are linked into /usr/local/bin as:
python python2 python2.7 idle idle2 and idle2.7
Then, provided you had altered your startup file {.bash_profile/.zshrc) to:
export PATH=".:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:$PATH"
then your #!/usr/bin/env python would work as expected.
It might be better to forget about Python 2.7.18 and just install python 3.10.5 (Universal2 binary) or later from Python.org as it is currently supported and newer than the Python3 that Apple includes with Xcode or just the Command Line Tools for Xcode. It would install into the same locations as above with the exception of being named python3, idle3, etc. Changes would be:
export PATH=".:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:$PATH"
#!/usr/bin/env python3
and any Python2 to Python3 specific changes to your code that may be necessary. The Python.org code does not directly support Apple's Python scripting bridge that was lost with the removal of Python 2.7.18, so you won't be doing any Python/Objective-C programming without tweaks.
Python.org download page for either of the above Python releases. This is a .pkg installer designed for macOS.