r/learnpython • • 2d ago

updating Python on macOS

How do you update Python on macOS? I looked it up and from what I can tell, there is no simple command you can enter into the terminal to update it, and you have to instead go to the website https://www.python.org/downloads/ and download and install it manually to update which is inconvenient. There's also the question of removing the old versions you have no intention of using anymore.

I am aware of Homebrew and I do have it for other things I've installed, but I want to try to only use it to download things to my MacBook that I otherwise couldn't. Python can easily be downloaded for mac separately and I want to keep it that way if possible. Is there no update command for the mac terminal to simply update Python?

12 Upvotes

30 comments sorted by

View all comments

Show parent comments

2

u/Geoff12889 2d ago

Any suggestions on a crash course to learn about virtual environments? Preferably whatever is built into vanilla Python.

4

u/fiddle_n 2d ago

This blog article by Niels Cauterts named “Python Dependency Management is a dumpster fire” is one of the best articles I saw posted on here that really explains the problem at hand and what tools like venv and others (conda, uv, etc) are trying to solve.

As for actually using venv, there’s only three commands you need to learn - how to create a virtual environment, how to activate a virtual environment and how to described it. Commands are slightly different depending on your OS and shell, so I would suggest just reading https://docs.python.org/3/library/venv.html to understand how to use them.

1

u/Geoff12889 2d ago

Thanks, I'll check these out. Using venv should beat using Anaconda, I'd assume.

1

u/SilentBlueberry2 1d ago

To expand on the other answer, venv works great for packages listed on pypi or things you install with pip. You'd reach for pixi or conda when you need something that is OS dependent, like say a compiler like libgcc or something. For 95% of my projects, I use uv /venv, and for science heavy stuff, I use pixi.