install python brew
$ brew install python
Source: www.poftut.com
brew install python@2
# Download/run the legacy macOS installer (pick which one for your sys) https://www.python.org/downloads/release/python-2716/ # Add pip for python2.7 curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip2.py python2 get-pip2.py # Optionally check for pip updates (in case of post-eol patches) python2 -m pip install --upgrade pip # Optionally add the helpers like easy_install back onto your path # In your ~/.zprofile or whatever bash/shell profile equivalent PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH # Optionally add some helpers while editing shell profile alias pip2="python2 -m pip" alias venv2="virtualenv -p python2" alias venv3="virtualenv -p python3" # Optionally some apple-specific std libraries are missing, search # and download them. Example: plistlib.py curl https://raw.githubusercontent.com/python/cpython/2.7/Lib/plistlib.py -o /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py # Lastly, there is no symlink /usr/bin/python anymore # /usr/bin is system protected so you can't add one either # # Change your programs to use /usr/local/bin/python # or google how to disable macOS SIP to make a symlink in /usr/bin
Source: stackoverflow.com