I have downloaded the latest build of pyscopg2 and have tried to build and install it using the directions provided. However i always get an error saying that 'w' is undeclared. Does anybody have any experience with this?
This is an error that crops up when the build tools cannot find your Postgresql libraries. It means one of three things:
You don't have postgresql installed on your system. If so, download and build postgres, or download a pre-built psycopg2 binary for OS X.
You have postgresql installed on your system, but you installed from a binary package and therefore don't have the necessary libraries that psycopg2 needs. In this case, download and build postgres.
More commonly, though, this means that you have built postgres on your system and just need to instruct psycopg2 how to find the
pg_config
binary so that it can configure the compilation. Either:a. put the path to pg_config in your shell path (it's usually at
/usr/local/pgsql/bin/
if you built postgres from source using the defaults.b. or, edit the
setup.cfg
file in the psycopg2 source folder and provide the full path topg_config
on the line that starts withpg_config=
. Be sure to uncomment this line by removing the hash symbol at the front. If you built postgres using the defaults, the line will look something like:pg_config=/usr/local/pgsql/bin/pg_config