IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Déploiement/Installation Python Discussion :

PyGreSQL -> n'arrive pas à l'installer


Sujet :

Déploiement/Installation Python

  1. #1
    Membre habitué
    Avatar de Olivier_
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    111
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 111
    Points : 127
    Points
    127
    Par défaut PyGreSQL -> n'arrive pas à l'installer
    Salut à tous,

    je souhaite utiliser PostgreSQL pour mes bases de données. J'ai donc installé PostgreSQL et pour interagir sur mes bases avec Python, il y a le module PyGreSQL, mais je n'arrive pas à l'installer :/

    Je ne comprend pas grand chose à la doc :
    GENERAL

    * You must first have installed Python and PostgreSQL on your system.
    The header files and developer's libraries for both Python and PostgreSQL
    must be installed on your system before you can build PyGreSQL. If you
    built both Python and PostgreSQL from source, you should be fine. If your
    system uses some package mechanism (such as RPMs or NetBSD packages), then
    you probably need to install packages such as Python-devel in addition to
    the Python package.

    * PyGreSQL is implemented as three parts, a C module labeled _pg and two
    Python wrappers called pg.py and pgdb.py. This changed between 2.1 and
    2.2 and again in 3.0. These changes should not affect any existing
    programs but the installation is slightly different.

    * Download and unpack the PyGreSQL tarball if you haven't already done so.

    STAND-ALONE

    * In the directory containing pgmodule.c, run the following command
    cc -fpic -shared -o _pg.so -I[pyInc] -I[pgInc] -L[pgLib] -lpq pgmodule.c
    where:
    [pyInc] = path of the Python include (usually Python.h)
    [pgInc] = path of the PostgreSQL include (usually postgres.h)
    [pgLib] = path of the PostgreSQL libraries (usually libpq.so or libpq.a)
    Some options may be added to this line:
    -DNO_DEF_VAR - no default variables support
    -DNO_DIRECT - no direct access methods
    -DNO_LARGE - no large object support
    -DNO_SNPRINTF - if running a system with no snprintf call
    -DNO_PQSOCKET - if running an older PostgreSQL

    On some systems you may need to include -lcrypt in the list of libraries
    to make it compile.

    Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4
    that does not have the PQsocket function. The other options will be
    described in the next sections.

    * Test the new module. Something like the following should work.

    $ python

    >>> import _pg
    >>> db = _pg.connect('thilo','localhost')
    >>> db.query("INSERT INTO test VALUES ('ping','pong')")
    18304
    >>> db.query("SELECT * FROM test")
    eins|zwei
    ----+----
    ping|pong
    (1 row)

    * Finally, move the _pg.so, pg.py, and pgdb.py to a directory in your
    PYTHONPATH. A good place would be /usr/lib/python1.5/site-python if
    your Python modules are in /usr/lib/python1.5.

    BUILT-IN TO PYTHON INTERPRETER

    * Find the directory where your 'Setup' file lives (usually ??/Modules) in
    the Python source hierarchy and copy or symlink the 'pgmodule.c' file there.

    * Add the following line to your Setup file
    _pg pgmodule.c -I[pgInc] -L[pgLib] -lpq # -lcrypt # needed on some systems
    where:
    [pgInc] = path of PostgreSQL include (often /usr/local/include/python1.5)
    [pgLib] = path of the PostgreSQL libraries (often /usr/local/lib/python1.5)
    Some options may be added to this line:
    -DNO_DEF_VAR - no default variables support
    -DNO_DIRECT - no direct access methods
    -DNO_LARGE - no large object support
    -DNO_SNPRINTF - if running a system with no snprintf call
    -DNO_PQSOCKET - if running an older PostgreSQL

    Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4
    that does not have the PQsocket function. The other options will be
    described in the next sections.

    * If you want a shared module, make sure that the "*shared*" keyword is
    uncommented and add the above line below it. You used to need to install
    your shared modules with "make sharedinstall but this no longer seems
    to be true."

    * Copy pg.py to the lib directory where the rest of your modules are. For
    example, that's /usr/local/lib/Python on my system.

    * Rebuild Python from the root directory of the Python source hierarchy by
    running 'make -f Makefile.pre.in boot' and 'make && make install'

    * For more details read the documentation at the top of Makefile.pre.in
    Il est question de fichier *.c à executer ou à placer dans tel ou tel dossier etc, mais je ne m'y retrouve pas :/
    Si vous aviez déjà fait la manip ou si vous comprenez quelque chose à ce qui est expliqué, un peu d'aide n'est pas de refus

    merci ! @+

  2. #2
    Expert éminent sénior
    Avatar de Guigui_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2002
    Messages
    1 864
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2002
    Messages : 1 864
    Points : 10 067
    Points
    10 067
    Par défaut
    Je te conseille plutôt psycopg pour les bases PostGreSQL (enfin, c'est cette bibliothèque qui me semble être le plus à jour de tous)

    Si t'es sous Windows, tu pourra trouver l'installateur ici: http://www.stickpeople.com/projects/python/psycopg/ (il faut quelques clics à partir de la page principale pour y arriver)

  3. #3
    Membre habitué
    Avatar de Olivier_
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    111
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 111
    Points : 127
    Points
    127
    Par défaut
    Ok, je me replis donc vers psycopg.
    Mais là aussi, je calle au niveau de l'install. Il est question de compiler quelque chose etc.
    Enfin bref, je n'ai jamais pratiqué ce genre de manip et ça ne "me parle pas" du tout :/

    C'est bizar qu'il n'y ait pas un installeur comme pour d'autres librairies...

    (p.s. je ne sais pas si ça entre en jeu, mais sait-on jamais, je suis sous windows)

  4. #4
    Membre habitué
    Avatar de Olivier_
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    111
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 111
    Points : 127
    Points
    127
    Par défaut
    Oups, j'ai suivi le mauvais lien :/

    J'ai suivi le lien de la page ressource de developpez.com et je n'avais pas d'installeur.

    Sur le second lien que tu me donnes que je n'avais pas vu, il y a bien un installeur ce qui me convient parfaitement à priori, mais le site hôte de l'installeur semble dans les choux :/

    http://www.stickpeople.com/projects/python/psycopg/psycopg2-2.0b4-pre4.win32-py2.4.exe

    <edit>
    le site remarche. Voilà la librairie d'installée merci !

    Reste à trouver une doc et à faire fonctionner tout ça Je verrais demain
    </edit>

  5. #5
    Expert éminent sénior
    Avatar de Guigui_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2002
    Messages
    1 864
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2002
    Messages : 1 864
    Points : 10 067
    Points
    10 067
    Par défaut
    Je crois que psycopg est compatible DBapi 2.0, donc ce sont les mêmes fonctions que pour les autres BDD.

    Sur ma page (http://guigui.developpez.com/), j'ai fait une interface pour une base Firebird (à priori, ca doit marcher aussi pour psycopg (quelques fonctions doivent change genre la connection mais sinon ca doit tout être bon)).


    Sinon sur le wiki, tu trouveras quelques petits exemples: http://wikipython.flibuste.net/moin.py/CodesBDD#head-1de05e18a14ba55c5d6771666df59ccac804bdcb

    Et enfin, t'as une doc complète (24 pages) mais en anglais ici:
    http://initd.org/tracker/psycopg/wiki/DbApiProgramming

  6. #6
    Membre habitué
    Avatar de Olivier_
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    111
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 111
    Points : 127
    Points
    127
    Par défaut
    Ca fonctionne, merci bien !
    J'ai récupéré la doc qui devrait convenir parfaitement.

    Je me pose une question cependant :
    C'est moi qui ne sait pas chercher ou bien il y a très peu de doc concernant l'accès aux bases de données PostgreSQL avec Python ?

    Résolu

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. N'arrive pas à essayer/installer Linux !?
    Par >-[]-Fab-[]-< dans le forum Ubuntu
    Réponses: 9
    Dernier message: 17/02/2009, 18h10
  2. je n'arrive pas a installe installeur d'oracle
    Par tonylundja dans le forum Oracle
    Réponses: 1
    Dernier message: 15/02/2008, 10h12
  3. Je n'arrive pas a installer pl/java sur mon postgresql
    Par eclesia dans le forum PostgreSQL
    Réponses: 0
    Dernier message: 13/01/2008, 17h01
  4. Je n'arrive pas à installer ma carte réseau
    Par jojo802 dans le forum Réseau
    Réponses: 2
    Dernier message: 19/10/2006, 10h47
  5. [C# 2005 Express] Pourquoi je n'arrive pas à l'installer ?
    Par Pierre8r dans le forum Visual Studio
    Réponses: 2
    Dernier message: 30/07/2006, 15h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo