1

What is the simplest tool to convert a python script into an executable file?

I made a python script and requirements.txt which contains necessary packages for a virtual environment with python3.6. I gave them to my client so that he can create a virtual environment and execute the file by executing the three lines below in the console.

source activate
python __main__.py
deactivate

Basically he needs to run it once a day, so that my python script scrapes a stock index data release at the end of each day and does some data transformation and saves the data in a desired directory as excel files.

However my client told me "even the three lines are difficult for people who are not familiar with CUI. Can you make it like a clickable icon?"

Is there any tool that can easily package my python script and required packages as an executable file or icon? It doesn't have to be cool. A simple and primitive tool would serve our needs. My client has Windows 10 Pro 64bit but it has to be something that I can develop in my My work environment which is Mac OS Catalina.

Thank you!

Makoto Miyazaki
  • 1,743
  • 2
  • 23
  • 39
  • 1
    Have you looked into pyinstaller. With a single command line you can convert scripts to exe. You can even hide the console from opening when the exe is clicked. – Rashid 'Lee' Ibrahim Aug 17 '20 at 18:55
  • Does this answer your question? [How can I make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-can-i-make-a-python-script-standalone-executable-to-run-without-any-dependen) – patmcb Aug 17 '20 at 19:00

1 Answers1

1

Yes, it is possible following library's help with this.

PyInstaller can be used, under Mac OS X, Windows, Linux,...

For an example i would read this medium post, it should contain everything to get you started.

py2exe can be used if you only want an executable for the Windows platform.

Robindpw
  • 58
  • 7
  • After a little research I think I will go for PyInstaller as it seems easier and I want to run it both on Mac and Windows. Thank you again for your advice! Is it also possible to include a set of necessary packages in the bundle? Just like setting up a virtual environment... And what happens if the user doesn't have Python installed in the PC? – Makoto Miyazaki Aug 18 '20 at 10:49
  • From the documentation we can read that: PyInstaller reads a Python script written by you. It analyzes your code to discover every other module and library your script needs in order to execute. Then it collects copies of all those files – including the active Python interpreter! – and puts them with your script in a single folder, or optionally in a single executable file. [Read this manual for more information](https://pyinstaller.readthedocs.io/en/stable/operating-mode.html). – Robindpw Aug 18 '20 at 14:11