Is it possible to have someone not have python installed, double click on my installer and through that get an executable, the python, and the needed libraries?
For that I would probably also want to know, if I can type anything but python path/file.py to run the python script. Because for that you would need to add the python installation to path. And is there a way to bypass this? To type something else instead of python like manually type the location where the executable is or so?
My boss asked me this today. Don’t think that’s a common task to do with python but if I know how to do that with python, I for one can do it with python and I will also easier understand how one normally writes installers and programs with guis and such. I do like python though.
I guess this is not an easy question. I really am interested though. If you can only answer the second question, I would also be very grateful because then i can figure out the rest I think.
-
1Yes, it is possible. This might be useful: net2.com/how-to-create-an-executable-from-a-python-programwhege– whege2021年10月13日 21:20:41 +00:00Commented Oct 13, 2021 at 21:20
-
1There's a difference between creating a executable from a Python script and installing it on a system — not all executables need to be installed in order to be run.martineau– martineau2021年10月13日 21:30:07 +00:00Commented Oct 13, 2021 at 21:30
-
I just thought that you would not only need the executable but also the libraries. I will try suggested solutions and see what happens. Big thanks for the help guys!Shaved Man– Shaved Man2021年10月13日 21:40:43 +00:00Commented Oct 13, 2021 at 21:40
-
2Im no expert, but I think pyinstaller takes care of the dependencies and libraries the code needsph140– ph1402021年10月13日 21:43:54 +00:00Commented Oct 13, 2021 at 21:43
1 Answer 1
You can use pyinstaller to create an executable. pip install pyinstaller in cmd.
Then cd into the directory where your file is, and type pyinstaller --onefile filename.py
Comments
Explore related questions
See similar questions with these tags.