1

I'm learning how to use Postgres with Python (sqlalchemy). I'm stuck when installing psycopg2. I have the following error :

pg_config executable not found error

I know that's a very common error and there is already a lot of answers about this but I couldn't find anything to help me solve my issue.

I especially don't understand this answers :

add the path to Postgres to your .profile file by appending the following:

PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

What does it mean ? what should I do exactly ?

I also tried to enter which -a pg_configin my terminal but nothing happen.

Thanks a lot !

7
  • 1
    What's unclear about that solution? You need to change the environment variable PATH so that pg_config can be found. Jan 19, 2017 at 11:49
  • should I do this from my terminal ? what should I enter exactly ? Jan 19, 2017 at 11:51
  • 2
    You could just type this into your terminal: PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH" (if that's indeed the path where pg_config is found), then press enter. Then build psycopg2. Jan 19, 2017 at 11:55
  • when I'm using my mac search bar for "pg_config" I can't find anything. and where doing which -a pg_config in my terminal nothing happen. Jan 19, 2017 at 11:57
  • Maybe there is a PostgreSQL development package that you didn't install and that contains pg_config. Jan 19, 2017 at 11:58

1 Answer 1

5

The problem was solved by typing

PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

into the terminal window prior to installing psycopg2.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.