From a0e33fd384412482122f05c00bf23f2e3d938338 Mon Sep 17 00:00:00 2001 From: Ken Colton Date: Wed, 31 Jan 2018 22:22:28 -0500 Subject: [PATCH] (osx) how to make `python` reference `python3` I noticed that the very next page (which is no longer OSX specific) makes the assumption that `python` will invoke the Python 3 interpreter, while the last mention of versions on this page leaves `python` referencing the OSX System Python interpreter. I honestly do not know if this is the "correct" way to configure this default. It looks like brew is cautious about symlinking over the native Python 2.7.10 (High Sierra) and they might have good reason. All of my projects are Python 3 now, so i'm ready to "make it ~facebook~ PATH official with Python 3" Regardless of how it's done - or if it's a bad idea - it's worth mentioning IMO because there is a discontinuity of where this page leaves `python` and where the next page assumes `python` to be. --- docs/starting/install3/osx.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/starting/install3/osx.rst b/docs/starting/install3/osx.rst index bd7ad7168..cda5320af 100644 --- a/docs/starting/install3/osx.rst +++ b/docs/starting/install3/osx.rst @@ -102,6 +102,22 @@ will launch the homebrew-installed Python 3 interpreter. If the Homebrew version of Python 2 is installed then ``pip2`` will point to Python 2. If the Homebrew version of Python 3 is installed then ``pip3`` will point to Python 3. +The rest of the guide will assume that ``python`` references Python 3. You can simply choose to always invoke ``python3`` instead, and much is backwards compatible. However, performing the following steps will set Python 3 as the default interpreter for ``python`` in a shell. + +.. code-block:: console + + # Do I have a Python 2 problem? + $ python --version + Python 2.7.10 # Referencing OSX system install + $ which python + /usr/bin/python # Yup, homebrew's would be in /usr/local/bin + + # Symlink /usr/local/bin/python to python3 + $ ln -s /usr/local/bin/python3 /usr/local/bin/python + + $ python --version + Python 3.6.4 # Success! + # If you still see 2.7 ensure in PATH /usr/local/bin/ takes pecedence over /usr/bin/ Pipenv & Virtual Environments -----------------------------