파이썬 공부한지 한 10여년이 지난것 같은데. 이제야 써먹네요 --;
[root@olmaster:/mnt/hgfs/common/]# tar xvfz psycopg2-2.4.5.tar.gz
[root@olmaster:/mnt/hgfs/common/]# cd psycopg2-2.4.5
[root@olmaster:/mnt/hgfs/common/psycopg2-2.4.5]# export PATH=/usr/pgsql-9.2/bin:$PATH ## pg_config 유틸 경로 지정
[root@olmaster:/mnt/hgfs/common/psycopg2-2.4.5]# pg_config ## 설치시에 pg_config 를 이용한다.
BINDIR = /usr/pgsql-9.2/bin
DOCDIR = /usr/share/doc/pgsql
HTMLDIR = /usr/share/doc/pgsql
INCLUDEDIR = /usr/pgsql-9.2/include
PKGINCLUDEDIR = /usr/pgsql-9.2/include
INCLUDEDIR-SERVER = /usr/pgsql-9.2/include/server
LIBDIR = /usr/pgsql-9.2/lib
PKGLIBDIR = /usr/pgsql-9.2/lib
LOCALEDIR = /usr/pgsql-9.2/share/locale
MANDIR = /usr/pgsql-9.2/share/man
SHAREDIR = /usr/pgsql-9.2/share
SYSConFDIR = /etc/sysconfig/pgsql
PGXS = /usr/pgsql-9.2/lib/pgxs/src/makefiles/pgxs.mk
ConFIGURE = '--disable-rpath' '--prefix=/usr/pgsql-9.2' '--includedir=/usr/pgsql-9.2/include' '--mandir=/usr/pgsql-9.2/share/man' '--datadir=/usr/pgsql-9.2/share' '--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-openssl' '--with-pam' '--with-krb5' '--with-gssapi' '--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls' '--with-ossp-uuid' '--with-libxml' '--with-libxslt' '--with-ldap' '--with-system-tzdata=/usr/share/zoneinfo' '--sysconfdir=/etc/sysconfig/pgsql' '--docdir=/usr/share/doc' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/include/et' 'CPPFLAGS= -I/usr/include/et'
CPPFLAGS = -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include
CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/include/et -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
LDFLAGS = -L/usr/lib64 -Wl,--as-needed
LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lcrypt -ldl -lm
VERSION = PostgreSQL 9.2.1
-- pyscopg 모듈을 이제 설치합니다.
[root@olmaster:/mnt/hgfs/common/psycopg2-2.4.5]# python setup.py install
Writing /usr/lib64/python2.6/site-packages/psycopg2-2.4.5-py2.6.egg-info
[root@olmaster:/mnt/hgfs/common/psycopg2-2.4.5]#
postgres@olmaster:~/oradba]$ cat sample.py
# Copyright (c) PostgresDBA.com
conn = psycopg2.connect("dbname=scottdb user=scott password=tiger")
cur.execute("SELECT ename, empno FROM emp;")
[postgres@olmaster:~/oradba]$ chmod 755 sample.py
[postgres@olmaster:~/oradba]$ ./sample.py
[postgres@olmaster:~/oradba]$
오 신기합니다.^^