realpython / realpython/python-guide

Describing making Python 3 the default `python` under Homebrew

Open
#960 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Batchfile
Stars
29.8k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

So, about this section in the OS X installation guides:

screen shot 2018-12-18 at 1 06 38 am

That opt/python/libexec behavior is not actually about 10.12 Sierra vs. newer versions of macOS. Homebrew does not make the unqualified python command be Python 3 on any version of macOS. If this behavior was different in the past, that was due to a different Homebrew version, not a different macOS version. (Homebrew's policy is to not shadow system-provided components in a way that might break things.)

Maybe this section should be updated to something like:

Once you've installed Homebrew, insert the Homebrew directory at the top
of your :envvar:`PATH` environment variable if you are running 10.12 Sierra or older.
You can do this by adding the following line at the bottom of your :file:`~/.profile` file:

.. code-block:: console

    export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

Now, we can install Python 3:

.. code-block:: console

    $ brew install python

Then, to make your default `python` command point to Python 3:

.. code-block:: console

    export PATH="/usr/local/opt/python/libexec/bin:$PATH"

And the section in the Python 2 installation about doing PATH="/usr/local/opt/python@2/libexec/bin:$PATH" is no longer necessary: the Homebrew python@2 formula now provides a python command that is in /usr/local/bin by default.

Might also want to provide a link to Homebrew's Homebrew and Python page, which goes in to more detail.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the OS X installation guides for the Homebrew and Python 3 section shown in the issue, then read Homebrew's Homebrew and Python page for current behavior. Update the Python 3 and Python 2 instructions to reflect PATH handling and link to the Homebrew documentation; done means the macOS-version distinction and default python command behavior are accurate.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.