Xcode problem on MAC M1 Monterrey

HI, I have a problem on my MAC pro m1 , with Monterrey. When I run for example the command python, this error appears

MacBook-Pro ~ % python xcode-select: Failed to locate 'python', requesting installation of command line developer tools.

this message is repeated constantly after downloading and installing the xcode

another option I did was downloaded it manually and installed it, but the error continues

I downloaded it from here

https://developer.apple.com/download/all/?q=command%20line%20tools

details: sw_vers ProductName: macOS ProductVersion: 12.3.1 BuildVersion: 21E258

xcode-select --version xcode-select version 2395.

python3 --version    Python 3.8.9

python --version     xcode-select: Failed to locate 'python', requesting installation of command line developer tools.

You have a clean (new) install of macOS 12.3.1. It doesn't have python. https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes

Search the interweb to find why 'python' doesn't usually resolve automatically to python3, and the various ways you can install multiple versions of python on your machine. I use pyenv.

I follow this steps and it works now

brew install pyenv
pyenv install --list
pyenv install 2.7.18
pyenv versions
pyenv global 2.7.18
Add eval "$(pyenv init --path)" to ~/.zprofile (or ~/.bash_profile or ~/.zshrc

Thank you @lcarrara. Running this all at once works too:

brew install pyenv
pyenv install 2.7.18
pyenv global 2.7.18
echo "eval \"\$(pyenv init --path)\"" >> ~/.zshrc
exec zsh
Xcode problem on MAC M1 Monterrey
 
 
Q