I'm trying to install psycopg2 in cygwin but have not succeeded yet. The error is:-
Gaurav@gauravpc ~/FieldAgentWeb/FieldAgentWeb
$ easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.2
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.2.tar.gz
Processing psycopg2-2.4.2.tar.gz
Running psycopg2-2.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QBYpxH
/psycopg2-2.4.2/egg-dist-tmp-gcLa5F
Error: pg_config executable not found.
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'.
error: Directory not empty <built-in function rmdir> /tmp/easy_install-QBYpxH/ps
ycopg2-2.4.2/tests
After that i was trying to get d pg_config file, but couldn't find it on the net.
The previous command may not work if you have both Python versions 2 and 3 on your computer. In this case, try "pip3 install psycopg2" or “ python -m pip install psycopg2 “. Wait for the installation to terminate successfully. It is now installed on your Windows machine.
The psycopg2 package is the current mature implementation of the adapter: it is a C extension and as such it is only compatible with CPython.
I just managed to install psycopg2 today without installing the windows PostgreSQL (in my case the db is already set up in another server, I just need to connect to it with a python package which depends on psycopg2, so having the complete installation it was not necessary for me).
Following pg_config executable not found , from the cygwin setup I installed postgresql-devel AND libpq-dev ( those should be the necessary ones, for the record I installed also a lot of other packages relative to postgresql like postgresql-client, postgresql-plpython and libpq5).
After that I could run succesfully pip install psycopg2
pg_config is part of your PostgreSQL installation. It's in the bin directory of your local installation (e.g. C:\Program Files (x86)\PostgreSQL\9.0\bin). Add that directory to your search path and try to build again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With