[Python] Images not being included within pyinstaller compilation

Discussão em 'Python' iniciado por Stack, Janeiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    Here are the files in my project directory:

    [​IMG]

    I executed the following in my terminal: pyinstaller --onefile --noconsole --add-data "ProjectImages;ProjectImages" main.py", which generated a build folder, dist folder and a spec file. Inside the dist folder is my main.exe, which when ran inside of pycharm works fine.

    However, whenever I drag the main.exe file somewhere else, the following error message appears:

    FileNotFoundError: [Errno 2] No such file or directory: C:\Users\cameron\Downloads\ProjectImages\PasswordHiddenImage.png

    PasswordHiddenImage.png is one of many images within my ProjectImages file. Does anyone know why my exe file is looking for the ProjectImages folder after compilation and how to fix this?

    Continue reading...

Compartilhe esta Página