Creating an “ELF” from “.PY”

[ ryn0f1sh ]
4 min readDec 1, 2022
Photo by Misty Ladd on Unsplash

Hello World.
I know its December, so let me be clear, I’m not talking about a mythical creature Elf, I’m talking about the Linux executable file ELF, though it is just as magical in my opinion. ELF stands for (Executable & Linkable File). And in many ways it is the equivalent of Windows’ “exe” or “Executable” file.

Executable files are very attractive to me, because it really makes the process of using the tools so much easier. These executables just run, they don’t need the user to install python on the machine, or install dependencies, because all those requirements are nicely packaged into this single file. At least that has been the case with my simple python created tools.

// What Do I Need The ELF To Do.
I just need it to run. I need the user to be able to simply run the tool in their Linux machine, easily and quickly. Without needing to install anything additional (if they don’t want to). Plug and Play if you will.

// Why Do I Want This?
Well, selfishly, I would like to be able to make my tools portable. I can already do that for Windows by creating an “exe” file of my python tools, which allows me to just plug the flash drive into any Windows machine and run the tool. I would like to be able to do that, just as quickly, in a Linux machine.

If you ever had to git clone a project, then you know you will need a few minutes to run the dependencies from the “required.txt” file, and might have to do some minor configurations, depending on the tool. And as of the writing of this post, you probably have to do that with any of the tools I’ve created as well. But I want to solve that. Don’t get me wrong, the source code will still be provided, but I just want to give users the option of just “using” the tool, without having to go through any extra steps just to get it running. That is were the ELF files come into play.

// PyInstaller
The Good News: The same command works in both Windows & Linux. When you run the command in Windows, it will give you an “exe”, when you run it in Linux, it will give you an “ELF”.

In Windows you take out the “sudo”.

[ ryn0f1sh ]

Sudanese / Blogger / Pen Tester / Python Charmer / Machine Learner / Lover Of Outer Space / Coffee Drinker (