 <p>I found my way around it. I noticed it installs successfully globally. So I installed psycopg2 globally and created a new virtual environment with <code>--system-site-packages</code> option. Then I installed my other packages using the <code>-I</code> option.</p> <p>Hope this helps someone else.</p> <p>OK. I later found out that I had no <code>gcc</code> installed. So I had to install it first. And after that, I could <code>pip install psycopg2</code>. Thank you cel for the direction.</p>