PyInstaller: cannot exclude a module

Viewed 2747

I have compiled the exe of a .py file but the problem is that it is 200mb+ I would like to remove useless packages (for instance scipy that I am not using).

Still I have not clear the proper syntax of PyInstaller.

Let's start from the beginning...usually I do on cmd:

cd myFolder
C:\Python27\Scripts\Pyinstaller.exe MyFile.py 

and it gives me the exe file in the dist folder.

If I want to set some configuration which is the proper way?

C:\Python27\Scripts\Pyinstaller.exe MyFile.py Config.py

or

C:\Python27\Scripts\Pyinstaller.exe Config.py

because online I found both of them but I could not distinguish.

If it is the last one I tried to run:

lock_cipher = None
a = Analysis(['Main.py'],
     pathex=['C:\Users\myname\Desktop\myFolder'],
     binaries=None,
     datas=None,
     hiddenimports=[],
     hookspath=None,
     runtime_hooks=None,
     excludes=None,
     cipher=block_cipher)
a.binaries = [x for x in a.binaries if not x[0].startswith("scipy")]
pyz = PYZ(a.pure, a.zipped_data,
     cipher=block_cipher)
exe = EXE(pyz)
coll = COLLECT(exe)

But it does not work. Where am I wrong?

1 Answers
Related