Installing psycopg2 (postgresql) in virtualenv on windows


I installed psycopg2 in virtualenv using easy_install psycopg2. I did not see any errors and looks like installation went fine.. there is an egg file created in the site-packages dir for psycopg2..

but when I run import psycopg2 in the interpreter, I am getting following error.. any clue? How can I fix it.. any other way to install psycopg2 in virtualenv..

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win32\egg\psycopg2\", line 69, in <module>
  File "build\bdist.win32\egg\psycopg2\", line 7, in <module>
  File "build\bdist.win32\egg\psycopg2\", line 6, in __bootstrap__


6/13/2010 3:42:02 AM

Edit: this solution is outdated. Refer to this answer instead.

I had the same problem. Following the suggestion on the download page of the Windows port for getting it working on Zope worked for me under virtualenv (also in the non-virtual install):

  1. Download the executable, rename the .exe extension to .zip
  2. Extract the file contents.
  3. Copy the psycopg2 folder to MyEnv/Lib
  4. Copy the egg to MyEnv/Lib/site-packages
5/23/2017 12:09:11 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow