Installing Python 2.x on macOS

You must install Python 2.7.9 or higher (but lower than Python 3) to run the Guardium Application Framework SDK on the macOS operating system.

Before you begin

Log in to your mac and run the command: $ xcode-select --install

About this task

macOS usually comes with Python 2.7.x. Do not use the macOS version of Python. Instead, install the latest Python 2 version using, for example, the Homebrew package manager. This installs an alternative Python, in addition to the existing Python.

Make sure Python command points to the latest Python you installed.

Procedure

  1. To install Python 2 using the Homebrew package manager,
    1. Install Homebrew with this command:
      ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    2. Install Python 2, enter: brew install python@2
    3. Make sure the Python command points to the latest Python you installed with Homebrew:
      ls -l `which python`
      You should see something similar to:
      /usr/local/bin/python -> ../Cellar/python@2/2.7.14_3/bin/python
    4. Check that your installed Python version is running, enter python --version

      The system should respond with the version number, 2.7.9 and higher.

  2. Alternatively, you can install Python with pyenv.
    1. Install pyenv, enter pip install pyenv
    2. Install Python, enter pyenv install <version>, for example pyenv install 2.7.9
    3. Check that the Python version was installed, by entering pyenv versions
    4. Use Python locally, enter pyenv global 2.7.9
    5. Check that your installed Python version is running, enter python --version