Avviare applicazione con doppio clic su Win e Mac

di il
11 risposte

Avviare applicazione con doppio clic su Win e Mac

Buongiorno a tutti, ho realizzato la mia prima applicazione grafica in python e funziona bene, ma vorrei poterla avviare con il doppio clic sia su Win che su Mac, uso pycharm, insomma vorrei realizzare un eseguibile tipo jar

11 Risposte

  • Re: Avviare applicazione con doppio clic su Win e Mac

    Ciao patel,
    puoi usare "PyInstaller"
    https://www.pyinstaller.org/downloads.htm
    non conosco estensione jar io lo uso per exe su windows
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Grazie del consiglio, l'estensione jar caratterizza gli eseguibili java, questi file possono essere eseguiti su qualsiasi piattaforma
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Una volta installato PyInstaller come lo si usa ? occorre dare i comandi da terminale ? non c'è un modo più umano ?
  • Re: Avviare applicazione con doppio clic su Win e Mac

    patel ha scritto:


    Una volta installato PyInstaller come lo si usa ? occorre dare i comandi da terminale ? non c'è un modo più umano ?
    ahahahah bella questa

    è facile stai tranquillo ovviamente basta leggere un pochino la guida ma niente di complicato
    https://pythonhosted.org/PyInstaller/usage.htm

    basta che scrivi :
    pyinstaller nomefile.py
    io aggiungo --onefile che ti pacchettizza tutto in un unico file e --noconsole non ti visualizza il promt quando esegui il file
    le opzioni vengono inserite fra il comando ed il nomefile e quest'ultimo se ha un indirizzo diverso devi inserirlo completo del path tra i doppi apici
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Questo il risultato che ottengo
    PS C:\> cd \Programmi\Python36\Scripts
    PS C:\Programmi\Python36\Scripts> pyinstaller --onefile copia.pyw
    62 INFO: PyInstaller: 3.4
    62 INFO: Python: 3.6.0
    62 INFO: Platform: Windows-10-10.0.17134-SP0
    62 INFO: wrote C:\Programmi\Python36\Scripts\copia.spec
    62 INFO: UPX is not available. <<<<<<<<<<<<<<<<<<<<<<<<<
    62 INFO: Extending PYTHONPATH with paths
    ['C:\\Programmi\\Python36\\Scripts', 'C:\\Programmi\\Python36\\Scripts']
    62 INFO: checking Analysis
    78 INFO: Building because inputs changed
    78 INFO: Initializing module dependency graph...
    78 INFO: Initializing module graph hooks...
    78 INFO: Analyzing base_library.zip ...
    2984 INFO: running Analysis Analysis-00.toc
    2984 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
    required by c:\program files\python36\python.exe

    3015 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\python.exe
    3046 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\python.exe
    3078 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\program files\python36\python.exe
    3093 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\python.exe
    3124 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\program files\python36\python.exe
    3249 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3281 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3312 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3343 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3374 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3406 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3437 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3468 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3515 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3546 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3577 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3609 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\program files\python36\python36.dll
    3640 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\VCRUNTIME140.dll
    3671 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\VCRUNTIME140.dll
    3702 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\VCRUNTIME140.dll
    3734 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\program files\python36\VCRUNTIME140.dll
    3765 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\VCRUNTIME140.dll

    3765 INFO: Caching module hooks...
    3781 INFO: Analyzing C:\Programmi\Python36\Scripts\copia.pyw
    3921 INFO: Loading module hooks...
    3921 INFO: Loading module hook "hook-encodings.py"...
    4015 INFO: Loading module hook "hook-pydoc.py"...
    4015 INFO: Loading module hook "hook-xml.py"...
    4249 INFO: Loading module hook "hook-_tkinter.py"...

    4281 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_tkinter.pyd
    4312 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_tkinter.pyd
    4343 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\_tkinter.pyd

    4468 INFO: checking Tree
    4499 INFO: checking Tree
    4531 INFO: Looking for ctypes DLLs
    4531 INFO: Analyzing run-time hooks ...
    4531 INFO: Including run-time hook 'pyi_rth__tkinter.py'
    4531 INFO: Looking for dynamic libraries

    4577 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4609 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4640 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4671 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4702 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4734 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4765 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4796 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4827 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4859 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\program files\python36\DLLs\_ssl.pyd
    4906 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\unicodedata.pyd
    4937 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\unicodedata.pyd
    4968 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\unicodedata.pyd
    4999 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\pyexpat.pyd
    5031 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\program files\python36\DLLs\pyexpat.pyd
    5062 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\pyexpat.pyd
    5093 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\program files\python36\DLLs\pyexpat.pyd
    5124 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\pyexpat.pyd
    5156 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5187 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5218 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5249 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5281 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5312 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5343 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5374 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5406 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\program files\python36\DLLs\_hashlib.pyd
    5437 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_bz2.pyd
    5468 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\program files\python36\DLLs\_bz2.pyd
    5499 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_bz2.pyd
    5531 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\_bz2.pyd
    5562 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\_bz2.pyd
    5593 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_lzma.pyd
    5640 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\_lzma.pyd
    5671 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_socket.pyd
    5702 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\_socket.pyd
    5734 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\select.pyd
    5781 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\_tkinter.pyd
    5812 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\_tkinter.pyd
    5843 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\_tkinter.pyd
    5906 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    5937 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    5968 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    5999 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    6031 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    6062 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    6093 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    6124 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\program files\python36\DLLs\tk86t.dll
    6187 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6218 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6249 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6281 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6312 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6359 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6390 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6421 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll
    6452 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\program files\python36\DLLs\tcl86t.dll

    6452 INFO: Looking for eggs
    6452 INFO: Using Python library c:\program files\python36\python36.dll
    6452 INFO: Found binding redirects:
    []
    6468 INFO: Warnings written to C:\Programmi\Python36\Scripts\build\copia\warn-copia.txt
    6499 INFO: Graph cross-reference written to C:\Programmi\Python36\Scripts\build\copia\xref-copia.html
    6546 INFO: checking PYZ
    6546 INFO: Building because name changed
    6546 INFO: Building PYZ (ZlibArchive) C:\Programmi\Python36\Scripts\build\copia\PYZ-00.pyz
    6937 INFO: Building PYZ (ZlibArchive) C:\Programmi\Python36\Scripts\build\copia\PYZ-00.pyz completed successfully.
    6952 INFO: checking PKG
    6952 INFO: Building because name changed
    6952 INFO: Building PKG (CArchive) PKG-00.pkg
    9218 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
    9249 INFO: Bootloader c:\program files\python36\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
    9249 INFO: checking EXE
    9249 INFO: Rebuilding EXE-00.toc because copia.exe missing
    9265 INFO: Building EXE from EXE-00.toc
    9265 INFO: Appending archive to EXE C:\Programmi\Python36\Scripts\dist\copia.exe
    9593 INFO: Building EXE from EXE-00.toc completed successfully.
    PS C:\Programmi\Python36\Scripts>
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Beh dalle sritte si evince che non ti trova le librerie "WARNING: lib not found"
    non so il perchè di questa cosa, quando si fanno queste procedure c'è il rischio
    che alcune librerie non vengono gestite e quindi non funziona ma non so se sia
    questo il caso o ci sia un'altro problema di fondo fin'ora l'ho usato solo per piccoli
    script e a me funzionano bene ora non conosco il tuo codice più o meno complesso

    prova prima con un codice semplice solo un print o preceduto da un input prima
    cosi vedi se tutto funziona se la sintassi è giusta per lo meno si parte con una base
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Con un codice semplice funziona, il mio legge un csv di testo, crea una griglia di pulsanti ed assegna loro le azioni.
    Comunque il file exe creato con un codice semplice è molto lento all'avvio, quindi non mi sembra una buona soluzione.
    Per windows ho comunque risolto associando l'apertura del file .pyw a pylauncher, ma per mac non riesco.
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Patel ... sai che esiste la regola che vieta il crossposting qui e vai subito su altri forum a fare la stessa domanda?
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Chiedo scusa, ma non ci sono andato subito, la nuova discussione l'ho aperta per mac visto che qui non ho avuto risposte
  • Re: Avviare applicazione con doppio clic su Win e Mac

    patel ha scritto:


    Per windows ho comunque risolto associando l'apertura del file .pyw a pylauncher
    ma devi sempre aver installato python su proprio pc mentre con la conversione, il file è autonomo
    poi anche se funziona non hai un programma pacchettizzato nel senso che chiunque può modificare il codice

    per windows puoi provare queste due soluzioni: Py2exe oppure Cx_freeze
    per mac prova questo ma non ti assicuro nulla: https://www.youtube.com/watch?v=StX03gLS3O
  • Re: Avviare applicazione con doppio clic su Win e Mac

    Vero, ma io non ho velleità di distribuire i miei programmi, servono a me ed alla mia famiglia. Mi meraviglio però che per un linguaggio così diffuso si trovi tutto e di più riguardo alla programmazione e quasi niente riguardo alla pacchettizzazione
Devi accedere o registrarti per scrivere nel forum
11 risposte