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:\\PostgreSql
I got the same error on Win10 with Python 3.5 and Python 3.8, both are 64bit, and Postresql 12, also 64bit. DLL locations "c:\Program Files\PostgreSQL\12\bin" and "c:\Program Files\PostgreSQL\psqlODBC\bin" were added to the PATH but it caused another error:
Then I've checked what is going on with Process Monitor from Sysinternals and found that libpg.dll was looking for other DLLs. Finally, the following files:
were copied from "c:\Program Files\PostgreSQL\12\bin" folder to:
folders and now "import pg" works fine in both versions of Python.