Tuesday, June 22, 2010

How to install psycopg2 on Mac

1. download psycopg2 package from http://www.djangoproject.com/r/python-pgsql/(http://initd.org/pub/software/psycopg/),
2. set the POSTGRESQL_HOME environment variable in your .profile
export POSTGRESQL_HOME=/Library/PostgreSQL/8.4
export PATH=$POSTGRESQL_HOME/bin:$PATH
3. untar psycopg2-2.2.1.tar.gz file
tar xvfz psycopg2-2.2.1.tar.gz
4. then go to psycopg2-2.2.1 directory, run the following command:
sudo python setup.py install
5. it will come with the following log, which means pyscopg2 installation is successful:

...
copying build/lib.macosx-10.6-universal-2.6/psycopg2/tz.py -> /Library/Python/2.6/site-packages/psycopg2
byte-compiling /Library/Python/2.6/site-packages/psycopg2/__init__.py to __init__.pyc
byte-compiling /Library/Python/2.6/site-packages/psycopg2/errorcodes.py to errorcodes.pyc
byte-compiling /Library/Python/2.6/site-packages/psycopg2/extensions.py to extensions.pyc
byte-compiling /Library/Python/2.6/site-packages/psycopg2/extras.py to extras.pyc
byte-compiling /Library/Python/2.6/site-packages/psycopg2/pool.py to pool.pyc
byte-compiling /Library/Python/2.6/site-packages/psycopg2/psycopg1.py to psycopg1.pyc
byte-compiling /Library/Python/2.6/site-packages/psycopg2/tz.py to tz.pyc
running install_egg_info
Writing /Library/Python/2.6/site-packages/psycopg2-2.2.1-py2.6.egg-info

- End

No comments:

Post a Comment