Making a Python program into an executable file
Mats Wichmann
mats at wichmann.us
Mon Apr 11 14:19:24 EDT 2022
On 4/11/22 10:13, Brian Wagstaff via Python-list wrote:
> Dear Python team,
> I am trying to find out how to make my Python programs into executable files (.exe, I presume) using Pyinstaller. I searched on line for how to do this (the document I came across is headed Data to Fish), and it seemed that Step 1 was to download the most recent version of Python and click the Add Python to Path option. I tried to do this, but was given the option to Upgrade Python, and once I did this the Add Python to Path option seemed not to be available. Can you advise me what to do?
> Best wishes,
> Brian
Presuming this is Windows because it sounds like it (hint: it's useful
to say), you can rerun the installer from the Apps & Features applet by
clicking on Python and then selecting Modify (the option actually says
"Add Python to environment variables").
How to make an "executable" depends on whether you require to include a
copy of Python with that, or not. There are a larger number of
approaches for the latter than the former. zipapps come close for the
latter, if you get your entry point set up right; there's some logic
described there for building an exe as well, but it's a little tricky to
get right. There's a project called Shiv (search pypi.org to find this
one) that attempts to simplify that.
An approach that doesn't get mentioned often (and with which I have no
experience):
https://bazel.build/docs/windows#python
You might also want to look into BeeWare if you want to make a
self-contained app your of your program. Nice work happening in that
project.
More information about the Python-list
mailing list