'Converting python file into executable in ubuntu 12.04 OS

I have developed a python script to automate few things present in text file. when converted this python file to the executable in ubuntu20.04 version(through pyinstaller) works very well.

The same executable is not working on ubuntu 12.04 OS(an older version Linux). However, the python file(.py) file works without any issues in 12.04 as well

Please do suggest how to convert the python file to the executable in ubuntu 12.04 OS version

python version: 2.7 ubuntu: 12.04 version



Solution 1:[1]

humm, probably execution permission issue.

run this in your terminal:

chmod 777 {file path/name}

this gives a file , read/write and execute permission to the current user.

also, another possible issue could be that you are compiling your python code for 64-bit system and your old system (ubuntu 12.04) is a 32-bit OS?

to find out , you can run this command :

uname -ipm

while you are compiling using pyinstaller pass this param :

pyinstaller --target-arch=32bit scripts

from pyinstaller doc, you can't make your compiled app on linux forward-compatible:

The GNU/Linux standard libraries such as glibc are distributed in 64-bit and 32-bit versions, and these are not compatible. As a result you cannot bundle your app on a 32-bit system and run it on a 64-bit installation, nor vice-versa. You must make a unique version of the app for each word-length supported.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1