2

I am new to Python. Please excuse me if my question seems stupid. I have spent a lot of time before posting this.

When I searched for shipping python interpreter with the applications, I found solutions including installing separate applications, using third party modules, etc...

I was thinking of more direct approach: I first install python interpreter on my machine (windows). Then I ship the installed python interpreter (copy and paste the folder) with the pyc file of my application. And finally I create a simple batch program that executes the interpreter and running the pyc file. In this case, the user can simply run the application by simply running the batch program. I have tried it and it worked.

Although this solution seems the most obvious and the easiest one, I am in a doubt about it because I cannot find any one mentioning it. Is there anything wrong with my solution? I usually create desktop applications for windows.

Thanks in advance.

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Vino Rue
  • 71
  • 2
  • [Freezing tools](https://docs.python-guide.org/shipping/freezing/) -- “Freezing” your code is creating a single-file executable file to distribute to end-users, that contains all of your application code as well as the Python interpreter. – DarrylG Jul 06 '20 at 08:48
  • DarrylG I tried pyInstaller for a simple testing file which calls another simple file. The produced executable was accompanied with 53 files! I guess most of them are python modules and Visual C++ redistributables. – Vino Rue Jul 07 '20 at 08:33
  • 1
    @VinoRue--the result can be a simple file or everything can be in one file [What PyInstaller Does and How It Does It](https://pyinstaller.readthedocs.io/en/stable/operating-mode.html). For single file: `pyinstaller --onefile --windowed myscript.py` – DarrylG Jul 07 '20 at 09:21
  • @DarrylG--OK. Thank you. – Vino Rue Jul 07 '20 at 16:18

1 Answers1

0

Make a virtual environment for you application and then run run the command python filename.py --onefile --windowed while still being in the virtual env. activated,