0

I'm on a new Mac and installing Python. I believe I reinstalled my Python using Homebrew. The path, however, is unusual to me, and I'm wondering why it is located here:

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

I'm used to Python being somewhere like this, instead (which is also is):

/Users/user.name/Library/Python/3.9/bin

What is different about the first installation? Are there any special considerations if my Python is located here?

whoopscheckmate
  • 746
  • 8
  • 23
  • 2
    The `/Library/...` location is where the official Python distribution installer (not Homebrew) installs Python. There's nothing wrong, that's just the default path for frameworks on macOS. Homebrew would install under `/usr` if you use the defaults. – MattDMo Jan 10 '22 at 16:32

1 Answers1

5

/Library/Frameworks/Python.framework/Versions/3.x/bin/python3 is the Python distribution shipped with macOS.

It's usually a good practice to create your own Python environment for your projects instead of using the default Python installation (consider reading about pyenv).

If you want to use your Homebrew installation, run brew info python to find your Python installation path, then append the parent directory's path to your PATH variable by editing ~/.zshrc (assuming you're using zsh, the default shell).

$ brew info python
....
Python has been installed as
  /opt/homebrew/bin/python3
...
# inside ~/.zshrc
...
export PATH="/opt/homebrew/bin:$PATH"
....
Feline
  • 773
  • 3
  • 14
  • And I'm noticing in particular that you're appending to the *beginning* of PATH to ensure that this installation gets picked up before the default Python 3 installation. – whoopscheckmate Jan 10 '22 at 19:12