In theory, installing psycopg2 to connect with a PostreSQL database, would
be so easy as:
easy_install psycopg2

But in the default configuration of Mac Os X snowleopard 10.6 seems that we
get some errors.
This is an attempt to help to config you web2py with PostreSQL database and
psycopg2 connection plugin.

First, I installed PostreSQL from here:
http://www.enterprisedb.com/products/pgdownload.do#osx

Now, is where we should run easy_install, but seems that in default config
makes errors (as it did with me).

Well, I downloaded psycopg2 version: 2.2.1 from here:
http://initd.org/pub/software/psycopg/

So, I extracted the tar.gz

> tar zxvf psycopg2-2.2.1.tar.gz
>

And edited the setup.cfg in ( ./psycopg2-2.2.1/setup.cfg )
As said in the alternative section of [1], I added the line, with the path
to pg_config of PostreSQL installed.

> pg_config=/Library/PostgreSQL/8.4/bin/pg_config
>

Now, we're supposed to be able to use psycopg2, but still doing errors.
I found the fix in [2], we should change the python of snowleopard
installed, from 64bit version to 32bit version.
Here's the command:

> defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
>


Now, we can test that everything is going OK,
I'm running web2py source version.

I expect this could be useful for someone.

Again, sorry for my english.
Regards from Spain.

References:
[1] http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/
[2]
http://benkreeger.com/post/312281790/snow-leopards-python-26-site-packages

Reply via email to