Convert python script to exe files in Ubuntu
Introduction
Converting a python script to an executable has meaningful benefits.
- Python does not need to installed in the client machine
- Easy distribution
- Useful in automation tasks
The rest of the article is based on the sample script.
Environment tested on
- ๐ง Ubuntu 22.04
- ๐ Python 3.8
- ๐ท wine 6.0.3 (Ubuntu 6.0.3~repack-1)
Instructions
Perform the following commands in a terminal opened in Ubuntu.
-
Download python (version 3.8) from here. Make sure it should be the windows version.
-
Install
wine
. Wine is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, macOS, & BSD. -
Install python
-
Find out where
pip
orpython
is installed. We will create an virutal environment. For this we require, wherepython
is created. -
Setup an virtual environment
-
The
pip.exe
is located under /app/dist/converter/Scripts/ and install the packages -
Convert the script into EXE file
The output is generated in the
dist
folder. -
Copy and Test the EXE file in a windows machine. Open Command prompt or Powershell
Single excel file execution
Folder execution