简体   繁体   中英

Why doesn't my pyinstaller extract any exe files

I created a project for my friend and I would like to ask how can I solve my problem with PyInstaller?

My problem is that when I type

pyinstaller myprogram.py

It does create folders, but I can't find the .exe anywhere in them. It should be in dist, but it isn't.

Problem

The problem is that pyinstaller automatically bundles everything into your myprogram folder under dist . In that folder, you will find a myprogram.exe file that you can run. However, this isn't that convenient.

Solution

Adding the option, --onefile , such that pyinstaller --onefile myprogram.py should bundle all files into one exe under the dist folder.

-F will also work; however, it's less readable if you're going to come back to it later.

Footnotes

This will create a console when you run the .exe file - if you have a GUI in your script (like Tkinter or PyQt), use --windowed .

Alternatively, you could do --onedir and send your friend an entire folder - may be a little easier.

Adding the --add-data {filename}:DATA will bundle files with your exe - use sys._MEIPASS (see this great StackOverflow post ).

And finally, if you're just printing stuff, the console window will close as soon as everything's done.

See here for other options commonly used.

Solutions

This may seem obvious but- delete the files created by pyinstaller and run pyinstaller again.

If that doesn't work try and reinstall pyinstaller.

In worse case scenario, Use another software to make.exe files from.py files.

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