psycopg2 on windows

Today when I'm trying to start a python app with SQLAlchemy, which using PostgreSQL as the database on windows. It tries to use the module psycopg2.

The environment is python 3.5 64-bit. There is a windows ported version of psycopg2 from win-psycopg. But when I tried to start the app, I got an error:

from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: DLL load failed...

There are some people getting this error on windows, and there are several solultions like:

Adding the binary folder of postgreSQL to PATH. e.g: C:\Program Files\PostgreSQL\9.4\bin

I tried, but not working, so I searched more and found there are one another windows-port for psycopg2 at Unofficial Windows Binaries for Python Extension Packages.

The downloaded file is a pip .whl file. So install it by:

pip install C:\Downloads\psycopg2-2.6.1-cp35-none-win_amd64.whl

And finally, it works!