Python 3 installation on macOS X not showing latest version

Today I tried to install Python 3.10.0 on macOS with the pkg.file form Python.org.

Afterwards when I checked the version in the terminal with Python --version It shows a previous version only, 3.8.8

When I run Python 3 from terminal it seems to run but I still don’t know why it’s now showing in the version.

Someone elsewhere suggested I run; ls -ls /usr/bin/python

the output is;

~ % ls -ls /usr/bin/python
0 lrwxr-xr-x  1 root  wheel  75 Jan  1  2020 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Not sure what that means.

when I run whereis Python and go to the folder it can see multi different python files but not sure what I can and can’t delete.

What am I missing? I’ve installed homebew based on this link; How to Install Python 3 on Mac – Brew Install Update Tutorial but then I get the following error;

~ % pyenv install 3.10.0

python-build: use openssl@1.1 from homebrew

python-build: use readline from homebrew

Downloading Python-3.10.0.tar.xz...

-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz

Installing Python-3.10.0...

python-build: use readline from homebrew

BUILD FAILED (OS X 11.6 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/1_/vvptc2s579s9vf81d_z0wlq80000gn/T/python-build.20211012165011.45283

Results logged to /var/folders/1_/vvptc2s579s9vf81d_z0wlq80000gn/T/python-build.20211012165011.45283.log

Last 10 log lines:

checking for python3.10... python3.10

checking for --enable-universalsdk... no

checking for --with-universal-archs... no

checking MACHDEP... "darwin"

checking for gcc... clang

checking whether the C compiler works... no

configure: error: in `/var/folders/1_/vvptc2s579s9vf81d_z0wlq80000gn/T/python-build.20211012165011.45283/Python-3.10.0':

configure: error: C compiler cannot create executables

See `config.log' for more details

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

The article says if I run into an error to reinstall xcode if it isn’t on yet but that’s 11gb and I’m not sure if it will fix whatever issue is causing it not to show when I check the version.

Any ideas?