在windows下使用
easy_installpsycopg2安装psycopg2时安装成功,但在python中import psycopg2时却提示如下错误:
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: 找不到指定的模块。为何??
ImportError: DLL load failed: The specified module could not be found.the file _psycopg.pyd is a dll. For its relatively small size it isprobably dynamically linked to the libpq.dll. I think the systemeither fails to find libpq.dll or some of the other dependencies (theyare listed in the setup.py).
I suggest you to use a tool to check its dll dependencies (maybe could be ok) and see if there isanything missing. If libpq.dll is the missing one, try putting it in aPATH directory or in the psycopg2 package directory.具体解决方案如下: 查找libpq.dll,将其copy到psycopg2的包中,或者放置在系统PATH下即可