学以致用

focus on Python , C++, and some interest in Go and R

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

在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 is
probably dynamically linked to the libpq.dll. I think the system
either fails to find libpq.dll or some of the other dependencies (they
are listed in the setup.py).
I suggest you to use a tool to check its dll dependencies (maybe
http://www.dependencywalker.com/ could be ok) and see if there is
anything missing. If libpq.dll is the missing one, try putting it in a
PATH directory or in the psycopg2 package directory.


具体解决方案如下:
查找libpq.dll,将其copy到psycopg2的包中,或者放置在系统PATH下即可
posted on 2011-06-28 16:30  Jerry.Kwan  阅读(4572)  评论(1编辑  收藏  举报