简体   繁体   中英

black console using py-to-exe

i tried to make an executable file from my main_app.py using pyinstaller. All works but when im duble click the.exe files generated its popping out just a black console, not the app..

This is the command i used:

pyinstaller --onefile -w main_app.py

Also i used and auto-py-to-exe all variants, and i have the same problem, nothing displayed on the.exe after double click, just the black console

This is how my project looks: 目录文件

I have the main_app.py file that calls the others scripts from different subdirectories:

from gitscripts.main_git import gitmainfunction
from svnscripts.main import svnmainfunction
from jirascripts.jira_main import jiramainfunction
from confluencescripts.confluence_main import confluencemainfunction
print("\nWelcome to `Easy Datas`!\n")
print("Before trying to use the app be sure that you are connected to URA and ADN 2.0 !!\n")
print("Below are the current type of datas that can be processed: ")
print(" SVN (s)\n GIT (g)\n BUGZILLA (b) \n JIRA (j) \n Confluence(c)")


def main_app():
    subject = input("\nChoose for what datas do you want to make the final raport (s/g/b/j/c):")
    match subject:
        case "s":
            svnmainfunction()
        case "g":
            gitmainfunction()
        case "b":
            bugzillamainfunction()
        case "j":
            jiramainfunction()

        case "c":
            confluencemainfunction()
if __name__ == '__main__':
    main_app()```

This is how the program looks using the IDE compiller vs.exe file: 在此处输入图像描述

He should display what is in the left corner, but isnt it. In the main_app.py i just called all the function/scripts from those subdirectories. If someone can help me solving this or if you know other way to make main_app.py to.exe

Ty!

You can use auto-py-to-exe for this, type auto-py-to-exe instead of pyinstaller --onefile -w main_app.py as this does not always work.

You have to include your external scripts in the build-process, as the subdirs with the scripts are not automatically available to your *.exe .

Please refer to the dokumentation: https://pyinstaller.org/en/stable/spec-files.html#adding-files-to-the-bundle

This is also detailed in this post (just an example, there are a lot more): Pyinstaller not picking up Tree or Data files

Looks like the answer from @ezpie shows that the issue is from your end. I'd suggest reinstalling pyinstaller. First uninstall pyinstaller: pip uninstall pyinstaller . Next Use the following commands seperatly to make sure your pip is fully updated:

python -m pip install --upgrade pip
pip install --no-use-wheel --upgrade distribute
pip install --upgrade setuptools

if --no-use-wheel doesn't work use --no-binary:all:

After this reinstall pyinstaller pip install pyinstaller

Now make sure you are running the exe in your dist folder and not your build folder. Finally, if this is difficult, reinstall auto-py-to-exe, and use that. If the problem still persists then I can't really help you furthur as it sounds like it is potentially an issue with your system. Hope this helps:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM