0
votes

I need to run a script on synology DS116 which contains psycopg2. The program is written in Python 3.7.

When installing psycopg2, it gives an error:

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'.

How can I fix this error if I cannot install libpq-dev using apt-get, because I am using Synology?

1

1 Answers

0
votes

Use the version of psycopg2 that does not require a build system on the user end:

https://www.psycopg.org/docs/install.html#binary-install-from-pypi

" psycopg2 is also available on PyPI in the form of wheel packages for the most common platform (Linux, OSX, Windows): this should make you able to install a binary version of the module, not requiring the above build or runtime prerequisites."

So:

pip install psycopg2-binary