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.
It seems to me that Homebrew defaults to Python 3.11.6 due to the current configuration of your system PATH or the way Homebrew has linked the Python versions. To change the default version to Python 3.12, you might want to try the following steps:
Check the linking status of Python 3.12 using Homebrew:
If Python 3.12 is correctly linked but not coming first in the PATH, you may need to alter the system PATH. Update your shell profile (e.g.,
~/.zshrc
or~/.bash_profile
) to put the directory containing Python 3.12 executable before others:Alternatively, you might try using Homebrew's
link
command to change the default Python version. Be cautious as this could lead to broken dependencies:pyenv
:For a more robust solution, consider using pyenv to manage multiple Python versions: