Bonjour,

je débute en python et j'ai un soucis.

J'ai fais ce script pour convertir en ligne de commande un xlsx en csv.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: utf-8 -*-
 
from pandas import read_excel as read_xls
import sys
 
def main(arg1, arg2):
    path_source = arg1
    path_destination = arg2
    print("Debut du traitement")
    print("Fichier XLS : " + path_source)
    print("Fichier CSV : " + path_destination)
 
    df = read_xls(path_source)
    df.to_csv(path_destination, encoding='utf-8', index = None,  header=True, sep = ';')
    print("Fini")
 
 
main(sys.argv[1],sys.argv[2])

J'utilise anaconda et j'ai crée un environnement pour y mettre que les library necessaire.

Or l'exe généré avec pyinstaller fait 300mo. Je pense qu'il y a des lib en trop....

J'utilise la commande suivante (en ayant pris soin d'être sur le bon environnement):
pyinstaller --onefile --ascii --clean "C:\Users\moi\Documents\XLS_To_CSV.py"
Est-ce qu'il y a un moyen de dire à pyinstaller de ne prendre que les library necessaire ?
Je sais qu'il y a "Exclude" mais il faut déjà savoir quoi enlever et là je suis largué

Voici les library que j'ai dans l'environnement :
Package                   Version
------------------------- ---------
altgraph                  0.17
astroid                   2.4.2
Bottleneck                1.3.4
certifi                   2021.10.8
colorama                  0.4.4
et-xmlfile                1.1.0
future                    0.18.2
isort                     5.6.4
lazy-object-proxy         1.4.3
macholib                  1.14
mccabe                    0.6.1
mkl-fft                   1.3.1
mkl-random                1.2.2
mkl-service               2.4.0
numexpr                   2.8.1
numpy                     1.21.5
openpyxl                  3.0.9
packaging                 21.3
pandas                    1.4.1
pefile                    2019.4.18
pip                       21.2.2
pycryptodome              3.12.0
pygubu                    0.10.3
pyinstaller               4.8
pyinstaller-hooks-contrib 2020.11
pylint                    2.6.0
pyparsing                 3.0.4
python-dateutil           2.8.2
pytz                      2021.3
pywin32                   302
pywin32-ctypes            0.2.0
setuptools                58.0.4
six                       1.15.0
tk                        0.1.0
toml                      0.10.1
wheel                     0.37.1
wincertstore              0.2
wrapt                     1.12.1
Merci d'avance