+2 votes
in Databases by (40.7k points)
edited by

I tried to install Psycopg2 using pip install Psycopg2 and conda install Psycopg2 for Anaconda running on my Windows system, but when I try to connect to postgresql database in python 3 code, i get error - python27.dll is not compatible with the current version of python.

How can I install the correct version of Psycopg2?

1 Answer

+2 votes
by (40.7k points)
selected by
Best answer

It seems that pip/conda didn't install the correct version of psycopg2 on your machine. Do the followings to install the correct version of psycopg2.

  • Download the correct version of .whl file from https://pypi.python.org/pypi/psycopg2. Suppose you have python 3.5 on your machine, download psycopg2-2.6.2-cp35-none-win32.whl (md5) or psycopg2-2.6.2-cp35-none-win_amd64.whl (md5) depending on 32-bit/64-bit of OS.
  • Open command prompt and use CD command to point to the folder where you downloaded the file.
  • then type pip install filename . filename is the file your downloaded. e.g. pip install psycopg2-2.6.2-cp35-none-win32.whl