I have installed fpdf2 with pip and afterwards I want to Installing it as a .exe with pyinstaller (Python 3.9). The code is running in the script, but after installing and starting the .exe I got from the .exe the error message:
Traceback (most recent call last):
File "example.py", line 1, in <module>
ModuleNotFoundError: No module named 'fpdf'
Pip installing:
`pip install fpdf2`
Command for pyinstaller:
pyinstaller example.py --onefile
Code of Example.py:
from fpdf import FPDF
pdf = FPDF(orientation="P", unit="mm", format="A4")
pdf.add_page()
pdf.set_left_margin(20)
pdf.set_right_margin(20)
pdf.set_top_margin(25)
pdf.set_font("helvetica", "", 16)
text_for_pdf = "Hello World"
pdf.multi_cell(0, 5, txt=text_for_pdf)
pdf.output("hello_world.pdf")
I have already updated all the modules and my Python version is 3.9. I have also tried:
pyinstaller example.py --onefile --hidden-import "fpdf"
I hope you understand my problem, thank you for helping my out! Best regards
source https://stackoverflow.com/questions/74788263/problem-pyinstaller-installing-fpdf2-module-module-not-found
Comments
Post a Comment