I am running into the same problem and cannot find a solution. This is what I see (note the developer command line tools are installed)
$ python
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
$ python3
Python 3.8.9 (default, Jul 19 2021, 09:37:32)
[Clang 13.0.0 (clang-1300.0.27.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ ln -s /usr/bin/python3 /usr/local/bin/python
$ which python
/usr/local/bin/python
$ python
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
$ /usr/local/bin/python
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
$ /usr/bin/env python
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
If I put another python on my PATH (outside of /usr/bin and /usr/local/bin) it seems to work fine. Eg,
$ ln -s /usr/bin/python3 /some/other/path/python
$ export PATH=/some/other/path:$PATH
$ which python
/some/other/path/python
$ python
Python 3.8.9 (default, Jul 19 2021, 09:37:32)
[Clang 13.0.0 (clang-1300.0.27.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
However, this is not a tenable solution and I have hundreds of scripts that rely on #!/usr/bin/env python. Is there a way to get xcode-select to stop prompting me to install command line tools for python?