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

怎甘沉沦 提交于 2019-11-29 11:11:05

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:\PostgreSQL\9.4;C:\PostgreSQL\9.4\bin
  • Also ensure that _pg.pyd exist in C:\Python27\Lib\site-packages

I faced just the same issue; just to try my chance before doing what you say, I changed the PATH environment variable: I directly specified the whole directory path of libpq.dll OF THE ODBC DRIVER OF PostgreSQL (there are other "libpqdll"s as well in other relevant directories) which takes place in my Windows10 here: C:\Program Files\PostgreSQL\psqlODBC\bin .. and the problem is solved.. before, my PATH specification was C:\Program Files\PostgreSQL and I think the driver looked for the dll files directly here and either 1) when couldnt find directly in this specific diretory (by disregarding the subdirectories), 2) or came cross other "libpq.dll"s which didnt work for the driver, it gave the error message.. so here I come to the conclusion that it looks for the dll file OF THE ODBC DRIVER in PATH env.varible, so I needed to specify in the PATH environment variable directly the directory of the PostgreSQL's ODBC driver I used, psqlODBC .. for future needs I wanted to write those details:)

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