Error: pg_config executable not found

I am getting this error when I use pip to install the required packages:

Error: pg_config executable not found.

    pg_config is required to build psycopg2 from source.  Please add the directory
    containing pg_config to the $PATH or specify the full executable path with the
    option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.

    If you prefer to avoid building psycopg2 from source, please install the PyPI
    'psycopg2-binary' package instead.

I don’t know the path to pg_config or how to find it. I searched on StackOverflow for solutions but most posts are related to Mac/Linux users, whereas I am on Windows 10.

I found a solution for this error which works on Windows 10. Install PostgreSQL and add it to the Path variable (In my case the path was C:\Program Files\PostgreSQL\12\bin). This will automatically add pg_config to the path as well and will fix the issue.

Hi,
I am running into the same error that you mentioned. I have added the path to PostgreSQL but I am continuing to get the same error message

Sorry, hit enter a bit fast there.Is there something else I should be doing? If anyone can offer advice it would be appreciated