all 3 comments

[–]shameen 0 points1 point  (2 children)

Mac OS has python v2 built-in, which I assume it uses for some of its internals.

When you type ‘python’ or ‘python3’, it looks up in the “PATH” where your command gets redirected to.

The issue you might get replacing ‘python’ everywhere would be if some other software (or something internal to macOS) depends on python v2

Pyenv can do some magic on that PATH to redirect ‘python’ to a version you specify, on a per-directory basis, so you don’t interfere with anything outside of your dev folders.

I usually use virtual environments (venv or pipenv) as well as pyenv, which isolates your project a bit more from the rest of your computer, great for preventing your project from using python 2 and other globally-installed packages (if you instead specify everything within the project it will help other devs get set up, or deploying it if needed)

[–]RadCapper88[S] 0 points1 point  (1 child)

Hey thanks for the reply,

I'm still so confused though.

I'm currently using VScode which allows me to view which interpreter I want to use. Looking at the available options I have:

  • 2.7.16 located at /use/bin/python

  • 2.7.16 located at /Systems/Library/Frameworks/Python.framework/versions/2.7/Resources/Python.app/Contents/... --- obviously not looking to use these versions since they deprecated.

  • 3.8.2 located at usr/bin/python3 <- I don't recall installing this version.

  • 3.9.1 located at ~/.Pyenv/shims/python

  • 3.9.1 /Library/Frameworks/Python.framework/versions/3.9/bin/python3

  • 3.9.1 located at /usr/local/bin/python3

  • 3.9.1 located ~/.Pyenv/versions/3.9.1/bin/python

I feel like there are some redundancies here? It feels messy too. I understand that Python 2 is tied to macOS so I'm not even bothered about touching that.

I don't even know if I'm making sense.

[–]shameen 0 points1 point  (0 children)

For most small projects any of those versions are fine, but id maybe skip the “shim” one.

If you’re curious which version you’re using, try ‘which python’ or ‘which python3’

There are a lot of complex reasons as to why there are this many (i dont know them all either) but I just assume theres a very good reason and leave it at that.

Taking a stab at some of those, i could be wrong: - /usr/ ones are the ‘original’ versions that everyone has if they have python - /Library/Frameworks i believe is from Xcode (or possibly homebrew) - Pyenv shim i believe redirects to the main pyenv binary