Issues with Python versions installed on my MacBook Pro laptop

Hi, I tried installing Python3.7.13 using brew utility and the same got intsalled successfully. However, there was another version of Python3.8.9 which was already installed as part of Upgrade from BigSur to Monterey. I just ran the command mentioned below to unlink python3.8.9 and link python3.7.13 version. brew unlink Python 3.8.9 brew link --force python 3.7.13

When I try to run python3 from the command line, it is pointing to python 3.7.13 but when the same command when tried running on /usr/bin/python3 I see that python 3.8.9 is getting linked which is incorrect and I want to point this to python 3.7.13 version Appreciate if there is any solution for this issue as I'm currently getting BLOCKED due to this. Here is the output of the same: % /usr/bin/python3  Python 3.8.9 (default, Mar 30 2022, 13:51:17)  [Clang 13.1.6 (clang-1316.0.21.2.3)] on darwin Type "help", "copyright", "credits" or "license" for more information.

Replies

Did you add brew python@3.7 to your PATH?

The output from brew install python@3.7 should include:

python@3.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have python@3.7 first in your PATH, run:
 echo 'export PATH="/usr/local/opt/python@3.7/bin:$PATH"' >> ~/.zshrc

For compilers to find python@3.7 you may need to set:
 export LDFLAGS="-L/usr/local/opt/python@3.7/lib"