Installing psycopg2 (postgresql) in virtualenv on windows

两盒软妹~` 提交于 2019-11-29 01:09:10
ropable

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

Have you checked that PostgreSQL's 'bin' directory is on the system path? Check with a quick typing of 'set' and see what you get.

This is the most common cause of import failures of psycopg2 on Windows.

Sayan Bhattacharya

There is an alternative to install python packages in your computer i.e, pip. You can download python packages by just executing:-

    pip install psycopg2 

The general format of the command is

    pip install [package-name]

P.S:- To install python packages globally through pip

    sudo pip install [package-name]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!