Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 20/02/2007, à 12:00

Piervit

compilation python

Bonjour

J'ai un programme python (donc en .py).
Python est déja installer sur la plupart des machines linux mais pas wxpython or le programme utilise wxpython.
Mon objectif serais que celui ci puisse etre éxécuter sur n'importe quelle machine linux sans que celle si ai besoin d'avoir python et wxpython déja installés.
Que me conseillez vous?


Si vous avez un peu de temps, visitez mon site web:
[L'iceberg de Tux

Hors ligne

#2 Le 20/02/2007, à 15:29

supergromz

Re : compilation python

Sous Windows, il y a py2exe qui transforme un script python en programme exécutable, en paquetant tous les DLL utilisés par le script (ou par python indirectement).
Sous Linux, il n'y a pas (à ma connaissance) d'équivalent.

Mais avec un peu d'huile de coude, tu peux parvenir à un résultat similaire.
C'est ce que je fais pour déployer mes scripts sur plusieurs machines du boulot (Sun Solaris, pas Linux) qui n'ont pas python et que les administrateurs ne me laisseront pas installer hmm

Il suffit de récupérer les librairies wxPython (et les librairies dépendantes wxWidget, et éventuellement les librairies GTK si elles ne sont pas disponibles sur les autres machines Linux...), de changer un peu tes variables d'environnement (LD_LIBRARY_PATH doit pointer sur le répertoire ou se trouvent ces librairies, PYTHONPATH aussi). Pour faire propre, tu peux créer un script shell qui positionne les variables d'environnement comme il faut, et qui lance le script.

L'utilisateur final lance un script shell, sans savoir tout le bricolage que tu as fait derrière. Est-ce que ca peut correspondre à ce que tu cherches? C'est assez succinct comme présentation de solution, mais c'est une piste éventuelle...

Hors ligne

#3 Le 20/02/2007, à 16:11

aleph

Re : compilation python

> supergromz

> Sous Windows, il y a py2exe qui transforme un script python en programme exécutable...

Ce n'est pas exactement une conversion py -> exe, mais plutôt py -> "quelque chose d'exécutable" avec les bibliothèques statiquement liées. Fonctionne à merveille.

Ce n'est pas le but de mon intervention.

> Sous Linux, il n'y a pas (à ma connaissance) d'équivalent.

http://pyinstaller.python-hosting.com/. Aucune expérience, mais souvent mentionné dans le forum des développeurs wxPython.

#4 Le 20/02/2007, à 19:48

Piervit

Re : compilation python

merci pour vos deux réponses.
Je regarde le pyinstaller mais sinon je regarderais la soluce de supergromz


Si vous avez un peu de temps, visitez mon site web:
[L'iceberg de Tux

Hors ligne

#5 Le 21/02/2007, à 11:50

supergromz

Re : compilation python

aleph a écrit :

Ce n'est pas exactement une conversion py -> exe, mais plutôt py -> "quelque chose d'exécutable" avec les bibliothèques statiquement liées. Fonctionne à merveille.

Oui alors si on joue sur les mots, rhooo, l'autre hé. roll
En tout cas, pour avoir essayé py2exe avec un script tapant dans le wxPython j'ai été conquis.
Je vais zieuter pyInstaller aussi, parce que ca a l'air plus simple que ma solution initiale big_smile

Hors ligne

#6 Le 24/02/2007, à 13:07

Piervit

Re : compilation python

J'ai essayé d'installer pyinstaller mais j'ai un probleme:

Les instructions demandent d'aller dans pyinstaller/source/linux/ puis de lancer make.py (jusqu'a la pas de probleme) et ensuite "make":

Or lors du make j'obtient une liste d' erreurs :

root@VIEUXTUX:/home/dan/pyinstaller-1.3/source/linux# ls
Make.py   bkfile.py   getpath.c  makemakefile.py
Makefile  bkfile.pyc  main.c     makemakefile.pyc

root@VIEUXTUX:/home/dan/pyinstaller-1.3/source/linux# python Make.py -n -e
WARNING: could not find Python static library at: /usr/lib/python2.4/config/libpython2.4.a
Now run "make" to build the targets: ../../support/loader/run ../../support/loader/run_d

root@VIEUXTUX:/home/dan/pyinstaller-1.3/source/linux# make
gcc -pthread  -I/usr/include -I/usr/include/python2.4 -I../common -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DHAVE_WARNINGS -c getpath.c -o getpath.o
getpath.c:39:20: error: Python.h: No such file or directory
getpath.c:40:20: error: osdefs.h: No such file or directory
getpath.c:42:23: error: sys/types.h: No such file or directory
getpath.c:43:22: error: sys/stat.h: No such file or directory
getpath.c:44:20: error: string.h: No such file or directory
getpath.c:54: error: 'MAXPATHLEN' undeclared here (not in a function)
getpath.c:57: error: 'NULL' undeclared here (not in a function)
getpath.c: In function 'reduce':
getpath.c:62: warning: implicit declaration of function 'strlen'
getpath.c:62: warning: incompatible implicit declaration of built-in function 'strlen'
getpath.c:63: error: 'SEP' undeclared (first use in this function)
getpath.c:63: error: (Each undeclared identifier is reported only once
getpath.c:63: error: for each function it appears in.)
getpath.c: In function 'isxfile':
getpath.c:108: error: storage size of 'buf' isn't known
getpath.c:109: warning: implicit declaration of function 'stat'
getpath.c:111: error: 'S_IFMT' undeclared (first use in this function)
getpath.c:111: error: 'S_IFREG' undeclared (first use in this function)
getpath.c:108: warning: unused variable 'buf'
getpath.c: In function 'joinpath':
getpath.c:135: error: 'SEP' undeclared (first use in this function)
getpath.c:138: warning: incompatible implicit declaration of built-in function 'strlen'
getpath.c:142: warning: incompatible implicit declaration of built-in function 'strlen'
getpath.c:145: warning: implicit declaration of function 'strncpy'
getpath.c:145: warning: incompatible implicit declaration of built-in function 'strncpy'
getpath.c: In function 'calculate_path':
getpath.c:152: warning: implicit declaration of function 'Py_GetProgramName'
getpath.c:152: warning: initialization makes pointer from integer without a castgetpath.c:159: warning: implicit declaration of function 'strchr'
getpath.c:159: warning: incompatible implicit declaration of built-in function 'strchr'
getpath.c:159: error: 'SEP' undeclared (first use in this function)
getpath.c:160: warning: implicit declaration of function 'strcpy'
getpath.c:160: warning: incompatible implicit declaration of built-in function 'strcpy'
getpath.c:169: warning: implicit declaration of function 'getenv'
getpath.c:169: warning: assignment makes pointer from integer without a cast
getpath.c:171: warning: implicit declaration of function 'malloc'
getpath.c:171: warning: incompatible implicit declaration of built-in function 'malloc'
getpath.c:171: warning: incompatible implicit declaration of built-in function 'strlen'
getpath.c:174: warning: implicit declaration of function 'strcat'
getpath.c:174: warning: incompatible implicit declaration of built-in function 'strcat'
getpath.c:177: error: 'DELIM' undeclared (first use in this function)
getpath.c:181: warning: incompatible implicit declaration of built-in function 'strncpy'
getpath.c:197: warning: implicit declaration of function 'free'
getpath.c:233: warning: incompatible implicit declaration of built-in function 'malloc'
getpath.c:233: warning: incompatible implicit declaration of built-in function 'strlen'
getpath.c:157: warning: unused variable 'numchars'
getpath.c:153: warning: unused variable 'argv0_path'
make: *** [getpath.o] Error 1
root@VIEUXTUX:/home/dan/pyinstaller-1.3/source/linux#

Si quelqu'un peut m'aider? Merci beaucoup.


Si vous avez un peu de temps, visitez mon site web:
[L'iceberg de Tux

Hors ligne