SSL handshake failed: localhost:27017

#run this in your terminal

sudo /Applications/Python\ 3.7/Install\ Certificates.command

#If you use other python version, only change versión number (In my case, i have Python 3.7)

Here is what the above code is Doing:
1. It’s creating a folder called .pip in your home directory.
2. It’s creating a file called pip.conf in that folder.
3. It’s adding the following lines to that file:
[global]
trusted-host = pypi.org
pypi.org = 443
files.pythonhosted.org = 443
4. It’s running the command sudo /Applications/Python\ 3.7/Install\ Certificates.command