So in the old days installing pip on MacOS was relatively easy.
You simply had to do:
sudo easy_install pip
Unfortunately, as of April 11th 2018 this will no longer work.
Why?
Python.org sites are stopping support for TLS versions 1.0 and 1.1. This means that MacOS 10.12 or older will not be able to use the easy_install pip
method described above.
The solution is to upgrade to the latest version of pip which will allow it to connect to the Python Package Index using TLS 1.2
To do this, we can run the following command.
curl https://bootstrap.pypa.io/get-pip.py | python
Pip 9.0.3 supports TLSv1.2 when running under system Python on macOS < 10.13.
Official release notes: https://pip.pypa.io/en/stable/news/
Here is a gist of the commands I use to install two of my favourite python modules with Pip on a fresh MacOS 10.12 + install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Download the get pip script | |
$ curl -o get_pip.py https://bootstrap.pypa.io/get-pip.py | |
## Switch to root user | |
$ sudo su | |
## Run the script as root | |
# ./get_pip.py | |
## Switch back to regular user and install modules with pip | |
# exit | |
$ pip install requests –user | |
$ pip install python-dotenv –user |