[Python] Using pyinstaller with deep_translator

Discussão em 'Python' iniciado por Stack, Junho 13, 2025.

  1. Stack

    Stack Membro Participativo

    I am writing a program to take in data from a spread sheet and write a custom letter based on that data and some user supplied information / sentences. This letter needs to be translated into Spanish as well as retaining the English copy, so I am using deep_translator to translate the relevant sections of text. This works great when I run it off the command line, but as soon as I try to package the files with pyinstaller, I get the following error message:

    Traceback (most recent call last):
    File "userInterface.py", line 5, in <module>
    File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
    File "reportGenerator.py", line 11, in <module>
    File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
    File "letter.py", line 1, in <module>
    ModuleNotFoundError: No module named 'deep_translator'
    [PYI-30260:ERROR] Failed to execute script 'userInterface' due to unhandled exception!



    The command I originally tried to use follows, but I have also tried using --collect-all and a custom hook file to no success. pyinstaller --onefile --hidden-import=openpyxl --hidden-import=docx --hidden-import=deep_translator --add-data "logo.py;." --add-data "student.py;." --add-data "filters.py;." --add-data "settings.py;." userInterface.py

    Continue reading...

Compartilhe esta Página