Psycopg2 Python SSL Support is not compiled in
<p>I am trying to connect to my postgres database using psycopg2 with sslmode='required' param; however, I get the following error</p>

<pre><code>psycopg2.OperationalError: sslmode value "require" invalid when SSL support is not compiled in
</code></pre>

<p>Heres a couple details about my system</p>

<ul>
<li>Mac OS X El Capitan</li>
<li>Python 2.7</li>
<li>Installed psycopg2 via pip</li>
<li>Installed python via homebrew</li>
</ul>

<p>Here is what I tried to do to fix the problem</p>

<ul>
<li><code>brew uninstall python</code></li>
<li><code>which python</code> still shows python living in <code>/usr/local/bin/python</code>, tried to uninstall this but couldnt. And heard that this is the python that the OS uses and should not be uninstalled anyways</li>
<li><code>brew install python --with-brewed-openssl --build-from-source</code></li>
<li><code>pip uninstall psycopg2</code></li>
<li><code>pip install psycopg2</code></li>
</ul>

<p>After doing all of this, the exception still happens. I am running this python script via <code>#!/usr/bin/env python</code> Not sure if it matters, but that is a different directory than the one that <code>which python</code> shows</p>