Install python3 from Homebrew vs the installer from https://www.python.org/?

Is there any advantage of installing python 3 through homebrew vs through the installer from https://www.python.org/ or vice verse (except that the installer can give me the latest version)?

I try both and I can't find the difference.

---- update ----

I now gain some insights about this question.

  1. If I install python through the installer, the installer will modify PATH in .zprofile like following and create softlink /usr/local/bin/python3
    # Setting PATH for Python 3.8
    # The original version is saved in .zprofile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
    export PATH
    
    # Setting PATH for Python 3.9
    # The original version is saved in .zprofile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
    export PATH

    ls -al /usr/local/bin/python3                             
    lrwxr-xr-x  1 root  wheel  69 11 20 11:18 /usr/local/bin/python3 -> 
    ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3
  1. if I then install python thru brew, brew will complain. Sometimes I don't run brew install python directly but install some bottle, which installs python, e.g brew install httpie will install python, then brew complains
    ...
    ==> Caveats
    Python has been installed as
      /usr/local/bin/python3
    
    Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
    `python3`, `python3-config`, `pip3` etc., respectively, have been installed into
      /usr/local/opt/[email protected]/libexec/bin
  1. macOS preinstall python at /usr/bin/python & /usr/bin/python3 which remain unchanged. But since PATH is modified by the installer or brew (brew puts /usr/local/bin before /usr/bin) so preinstall python is shadowed.

  2. I do find brew has an "annoying" feature, when brew’s Python being installed as a dependency for a bottle and then I uninstall the bottle, the brew's Python remains. For example I installed httpie and uninstalled it. But to my surprise my system python is still the one installed by httpie. It took me quite sometimes to figure out that.


I'd say it's entirely a matter of personal preference, as to whether you like to use HomeBrew or not.

There was a recent post about some problem with brew python, but it may be a local issue, or have been fixed. Python 3 'json' module is actually corrupted


For pure python it probably does not matter. All installations of extra modules are done using pip and you can deal with different versions of python with venv. The provision of venv and pipenv makes earlier answers less relevant as you now don't need a package manager, python now provides most of one.

The different installs differ when you need more complex native libraries.

I think pip makes some simplifying assumptions about the the compilation environment. The command line can be complex. There are several other issues that can be found on this site.

General package managers like MacPorts, Homebrew and Fink are built mainly to compile C libraries. If you use them rather than pip to install complex libraries like scipy then someone else has done all the complex work for you and it should be a simple install. You can still use pip for pure python so you are not limiting the choice of libraries you use.

However for the best overall management of python especially if it is your main development language I would look at Conda package manager. This is in essence a combination of a full package manger like Macports and Homebrew but originally designed for and written in python python and also provides similar functions to the python packaging of pip and venv. You can still use pip if needed. For an even easier way you can use Anaconda which is built on conda but the install includes many of the libraries you need for data science and also graphical front end to manage the packages.