Skip to content
Snippets Groups Projects

Utilisation de PyInstaller

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Gregory.Ooghe

    Comment utiliser PyInstaller pour créer un .exe à partir de scripts Python.

    Edited
    pyinstaller_utilisation.bash 1.02 KiB
    # Utilisation de pyinstaller :
    
    #  - se placer dans le répertoire du script
    
    cd pathtoscript
    
    #  - activer l'environnement virtuel
    
    .\Scripts\activate.ps1
    
    #  - se placer dans le répertoire Lib\site-packages
    # NE SEMBLE PLUS MARCHER
    # cd Lib\site-packages
    
    #  - exécuter pyinstaller :
    
    #avec '-F' --> un .exe
    #'--clean' --> pour ne pas mettre les fichiers temporaires
    #'--additional-hooks-dir=.' pour inclure les modules qui ne seraient pas détecter en première lecture
    #'--hidden-import="mise_en_forme_matrice.py"' pour inclure les modules qui ne seraient pas détecter en première lecture
    
    # NE SEMBLE PLUS MARCHER
    # python pyinstaller.py -F --clean --additional-hooks-dir=. --hidden-import="mise_en_forme_matrice.py"
    # "C:\Users\path_to_directory\main.py"
    
    pyinstaller main.py  -F --clean --additional-hooks-dir=. --hidden-import="autre_script.py"
    
    #  - enregistrer le 'main.spec' créé dans Lib\site-packages\main
    #  - ensuite il y juste à appeller le .spec
    
    python pyinstaller.py --debug=imports  "C:\Users\path_to_directory\main.spec"
    • Gregory.Ooghe @Gregory.Ooghe ·
      pyinstaller -F script.py 

      dans le dossier principal suffit maintenant en installant une version plus récente de pyinstaller.

      pip install --upgrade pyinstaller
      Edited by Gregory.Ooghe
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment