Uncategorized

python3 – How to confirm MacOS “system” Python version


On my machine with macOS 14.2.1 Sonoma, I found more than one python3. I’m not sure any “came with” Sonoma. First, in a terminal, which python3 returns ‘/opt/homebrew/bin/python3’. I looked in /usr/bin/ and found a python3 there, too. Using /usr/bin/python3 -h gave me too much info but showed a path indicating it was installed with Xcode.
Here’s a way to get the version: in a terminal, simply type the name of the python you want examine (this starts the python REPL – use Ctrl-D to exit). It will tell you about itself. I did that for the two pythons I found, and the one from homebrew was Python 3.11.6, and the one in /usr/bin was Python 3.9.6. If you ask homebrew to uninstall python, it will uninstall the one in its directory. Note that, at least on my system, only python3 shows up, not python or python2.

Added: Homebrew will uninstall the Python in the homebrew directory. This is not the system Python. The main point of homebrew is to add (and remove if necessary) software without messing with what the system uses. And as far as I remember, your macOS, Ventura, did not come with a system Python. Is there something else in this picture – such as another installation that depends on Python – that leads to your concern?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *