2

I'm having the exact same problem as described here: ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found

the error:

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

I'm using :

Python 2.7.3 64 bit
PygreSQL 4.1  (installed into C:\Python27\Lib\site-packages\ )
PostgreSQL 9.3.3 64 bit
Windows 7

I tried to fix the issue as listed in the answer but it doesn't work. Environment variables (PATH) are set:

C:\PostgreSQL;C:\PostgreSQL\9.3;C:\PostgreSQL\9.3\bin;C:\Python27\Lib\site-packages

PostgreSQL was installed to :

C:\PostgreSQL

_pg.pyd exists as said there.

However I still get the same error.

I should note that when I open a comand line and do:

import pg
import _pg

everything works.

What can still be the issue?

Community
  • 1
  • 1
avi
  • 1,626
  • 3
  • 27
  • 45
  • what is the *actual* python version that you use to run the command, vs. the python that you run from command line - you can prepend your script with `import sys; print(sys.version)` - this string should be the same as the one from console. – Antti Haapala -- Слава Україні Jan 19 '17 at 12:59
  • @AnttiHaapala I think this has something to do with the PygreSQL. On one computer it works... but on the other i see that the pg.connect is marked with error: Undefined variable from import: connect it is like he isn't able to import the pg library – avi Jan 19 '17 at 13:07
  • Do you have multiple versions of python installed on your computer? – raphael Nov 01 '17 at 19:24
  • Were you ever able to solve this? Running into the same issue. – Michael Black Nov 19 '19 at 04:55

0 Answers0