I have /usr/bin/python pointing to python3 which points to an executable called python3.13. This makes me assume this python comes with the image. OK. I am able to install other versions of python with brew.
python is not managed by alternatives, and linking and unlinking different versions in brew does not change /usr/bin/python. Considering that linuxbrew’s bin is first in the PATH, I would be happy to change the python link in there, but there doesn’t seem to be one, or else it would be used instead of /usr/bin/python.
How the heck am I supposed to get python to invoke the version I want from linuxbrew?
I DO have another version installed. My questions was, how do I fix it where I can type python and get the version I installed from brew instead of the system version? For some reason, brew installs the links (python3, python) in some obscure folder that is not in the PATH. The folder that is in the path, does not contain any of those links.
I used to use homebrew on my mac, and there was a way to choose which version to link. I have tried to unlink for all versions, and link for the version I want, but that does not make the links in the right folder either.
I don’t think it’s possible to replace the “system” version of python. Not sure if that is allowed on a Mac but in atomic Linux /usr is read-only and this is by design.
The closest thing you can do is change your own PATH and override the python3 command in some editable location that precedes /usr/bin
For example, you can use a bin folder under your home:
Generally I work with virtual environments, and once you enter the environment the PATH is set up to use the proper install from brew (and in fact does this by updating your PATH in a similar fashion to the above).
Since brew link/unlink does not also update /usr/bin, you can use another utility as @xlion suggested to manage python installs. Basically running “activate” in something like conda will effectively update your environment for you, so it’s no different than activating a virtual environment. The system python will still remain the same and /usr/bin/python3 will still launch the pre-installed python that comes with ublue…