0

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.

asked Oct 13, 2021 at 21:17
4
  • 1
    Yes, it is possible. This might be useful: net2.com/how-to-create-an-executable-from-a-python-program Commented Oct 13, 2021 at 21:20
  • 1
    There'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. Commented 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! Commented Oct 13, 2021 at 21:40
  • 2
    Im no expert, but I think pyinstaller takes care of the dependencies and libraries the code needs Commented Oct 13, 2021 at 21:43

1 Answer 1

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

answered Oct 13, 2021 at 21:23
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.