Finally it worked !!!
Thanks to the link that you gave me eyllanesc
in your comment I could solve the problem.
pyinstaller
can search for external dependencies, the only thing necessary is to generate a file .spec
(specification file) where you specify where to look for such dependencies.
APPEARANCE OF A .SPEC FILE
a = Analysis(['script.py'],
pathex=['C:\carpetaDelScript'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
This tells us to create a .exe
file from the script.py
file and that this file is inside the C:\carpetaDelScript
folder defined within the variable pathex
ADDING EXTERNAL DEPENDENTS
to generate a file .spec
we have to execute the command:
pyi-makespec options name.py
and to add a dependencies route we simply add the option:
--paths=[ruta de dependencias]
so the complete command would be:
pyi-makespec --paths=C:\carpetaDependencias script.py
what would generate a file .spec
similar to:
a = Analysis(['script.py'],
pathex=['C:\carpetaDelScript', 'C:\carpetaDependencias'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
you can add as many folders as you need
GENERATING THE .EXE
in the previous process we generated a .spec
with the same name as our script, to generate the .exe
we only execute the following command:
pyinstaller script.spec
this will generate a folder called dist
within it will be our executable.