I have all three versions of python 3.10, 3.11 and 3.12 using homebrew. but somehow homebrew defaults to using 3.11 as the default.
when i type which python3, it shows 3.11.6 as the version instead of 3.12. why did it default to 3.11 and how do i change this to 3.12?
I was expecting the latest version 3.12 to be the default.
The issue seems to be in the difference between [email protected] and [email protected] Homebrew Ruby scripts.
3.11 has link_overwrite for python3 which sets a bunch of symlinks in /usr/local/bin/ (which is usually in your $PATH) to use 3.11.
3.12 lacks this and so your shell is not seeing them.
You can rectify this either by modifying your $PATH as in the other reply, or replacing the symlink manually:
cd /usr/local/bin && rm python3 && ln -s ../Cellar/[email protected]/3.12.1/bin/python3.12 python3
Edit 2024-02-25: About four days ago, the below PR was merged. I believe brew install python should now install Python 3.12.
python3 in Homebrew won't point at 3.12 until this PR is merged. AFAIK Homebrew don't switch the default python3 to the latest version until all the Python software that Homebrew packages are confirmed to work with the new version.
If you really need python3 to point at 3.12 globally right now, I personally like @Iskander14yo's suggestion to use pyenv (above).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With