Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

python - ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found

I have the same problem that was discussed here, but I haven't credit to comment an answer so I start new question.

I have in PATH way to libpq.dll (C:PostgreSqllib) but it doesn't solve this problem.

Using Python 2.7.9 32-bit, PostgreSQL 8.4, Win 8

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
    import pg
  File "C:Python27libsite-packagespg.py", line 21, in <module>
from _pg import *
ImportError: DLL load failed: The specified module could not be found.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I was also facing the same issue on Win 8. First time I had installed PostgreSQL in "C:Program Files" and also set environment PATH to point to PostgreSQL folder. I was suspecting permission issue for "C:Program Files" folder.

I was able to fix this issue by following the steps as mentioned below.

  • Uninstalled PostgreSQL
  • Re-installed PostgreSQL in "C:PostgreSQL" Note that I have not installed PostgreSQL into "C:Program Files" folder this time
  • Set the environment PATH C:PostgreSQL9.4;C:PostgreSQL9.4in
  • Also ensure that _pg.pyd exist in C:Python27Libsite-packages

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...