Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to install psycogpg2 for working with 'django'.

I read the instructions but I dont understand whether to run the commands in command prompt or in python command line. I am lot used to the GUI installation.

So can you please anyone tell me how to configure settings and installation of psycogpg3 - where to keep the folders and changing directory etc etc..

share|improve this question

1 Answer 1

you can download current stable Psycopg 2.4.6 here or you can use PyPI(Python Package Install) with easy_install psycopg2.

if you download package, you can install it with python setup.py install command. dont forget that you will probably need python-dev and libpq-dev packages.

The pg_config must be available in your path, or alternatively you must specify its full path in the setup.cfg file.

after installation, you can call it:

import psycopg2

and example code from Postgresql Wiki:

import psycopg2

try:
    conn = psycopg2.connect("dbname='template1' user='dbuser' host='localhost'
                            password='dbpass'")
except:
    print "I am unable to connect to the database"

cur = conn.cursor()
cur.execute("""SELECT datname from pg_database""")
rows = cur.fetchall()

print "\nShow me the databases:\n"
for row in rows:
    print "   ", row[0]

i hope it helps you...

share|improve this answer
    
Thanks but where shall I run all these commands...as I said I am new to this kind of installation. –  Jeevan Patnaik Feb 11 '13 at 11:58
    
use terminal for installation. then write python to console for calling python then run this command. and it will help you to read this doc How To: Python Programming Under Ubuntu –  Aragon Feb 11 '13 at 12:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.