MacOS, Homebrew, Search Path, Default Version, and the Latest Version of Python

Over time, I’ve downloaded and installed 1 or more versions of Python. Now I’m becoming a bit more serious about this, so I used Homebrew, with this command:

brew upgrade python

Supposedly this upgraded Python to version 3.11.6_1.

But from a console window, if I type “python --version” I always get version 3.9.7.

I’ve tried uninstalling versions of Python I installed earlier and trimming my $PATH variable. I’m afraid to do too much blind hacking because I’ve read that newer versions of MacOS rely on an installed version of Python for certain critical functions. So, what’s the best way to configure my system to use the latest version of Python that Homebrew installed?

FWIW, I’m running MacOS 14.1 (Sonoma) on a 2021 14-inch MacBook Pro w/ 32 GB RAM & a M1 Max processor.

What is your PATH currently, and what installations do you believe you have currently? (Keep in mind that there can be more than one installation of the same version.)

Generally, they rely on whichever installation of Python came with the system. They may be specific to that installation (or at least version), too; but they should already include shebang lines that will force them to use the right one. The only really important thing is to not remove (ideally, not touch) that installation. (The same goes for most if not all varieties of Linux.)

Anyway, if I put macos choose python into a search engine, I get this as the first result. Does it help?