Reputation: 41
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.
Upvotes: 4
Views: 548
Reputation: 168
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.
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.
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.
Upvotes: 4
Reputation: 167
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.
Upvotes: 0