[Python] ModuleNotFoundError: No module named 'reportlab' after ModuleNotFoundError: No module...

Discussão em 'Python' iniciado por Stack, Fevereiro 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have made a python script with several imports at the beginning:

    from flask import render_template, request, send_file
    from reportlab.lib.pagesizes import A4
    from reportlab.pdfgen import canvas
    from reportlab.graphics.barcode import code128
    from reportlab.lib.units import mm
    import io
    import webbrowser


    After compiling the script to a .exe file keep getting the error:

    File "app2.py", line 7, in <module>
    ModuleNotFoundError: No module named 'reportlab'
    [PYI-33160:ERROR] Failed to execute script 'app2' due to unhandled exception!


    At first I got the same error for the flask module and I solved it with the following lines at the beginning of my script:

    import os
    os.system('pip install flask')


    But I am afraid installing each module each time the programm starts would make it unnecessarily slow. Is there another solution than another a 'pip install reportlab' statement?

    I am using python version 3.11.9

    Continue reading...

Compartilhe esta Página