Creating window executable file in linux - linux

I have written a bunch of python code. I want it to convert in the .exe file I know there is a lib(pyinstaller) for this but it works on window only if I use on terminal it convert the code into linux executable file. I want to know that is there any way by which i can convert python code into exe file in linux?

Related

How to make a python file un-editable and un-viewable the code?

I want to make my python file un-editable and anyone should not be able to view code. Client should only be able to run the python file not view the code.
I don't think if that it possible. But what you could do it compile it to the platform specific executable format such as .exe for windows. You could use pyinstaller for that
You Can Make the file read only but if you need to make the file executable it needs read and execute permission.As the interpreter needs to read the file to execute it.
You can make the file read only and executable by using the chmod command in unix based systems.
You can refer to this answer.

What exactly is main.py in python and how do I use it to create a one file executable using pyinstaller?

I am currently working on a demo project while learning python and decided to use Tkinter as a user interface for my system. After finishing on the GUI and setting up a MySQL database I tried to use pyinstaller and py2exe to create a standalone .exe but it creates only one executable for one python file and I have 6 python files.
After research I found that most people with multiple python scripts have one main.py file that runs all their scripts and they use this to create a standalone .exe. So since this seems to be the solution but my question is, what is this main.py file and how do I write it so that when I create a .exe it runs my program and still has all the scripts working?
all my python scripts
The first script that I want to execute when run my program is Login.py

Convert python file to .exe using pyinstaller

I'm trying to make executable Tkinter file with photos, video and two songs using pyinstaller. I've done it without pictures, but I don't know how to connect them in the exe file. Is it possible using pyinstaller, or I need to use some other module? I am using python 3.8.2
PyInstaller won't do such a thing. You need to provide your sound files manually. First, you need to add your sound files to the output executable with add-data flag then create a function to load your files from the extracted path

How to call a compiled fortran exe file in a deployed Matlab exe in Linux?

I am trying to use a deployed Matlab exe file in Linux, and in the middle of my matlab code I want to call a .exe file compiled by Fortran.
I have tested that the fortran-compiled binary exe file is alright to run in Linux and get my results both by directly calling it in commmand line and in Matlab by 'system(read_results.exe)'. But when I deployed the Matlab code, and call it by the following command:
./matlab_code.sh /cm/shared/apps/Matlab-R2019a
The Fortran .exe file cannot be called correctly and gives the following message:
Possible reason:read_results.exe: error while loading shared libraries: libgfortran.so.5: cannot open shared object file: No such file or directory
I guess this problem shoulbe be relatived with the environment variables or something like that. I don't know how to add those libraries to a deployed Matlab code, or how to compile the Fortran code to a totally independent binary file in Linux. Could anyone please help me with it? Thank you guys very much!!!!
( The reason I need to call a .exe file is I really cann't compile it to a DLL...So I have to use it in such a terrible way. )

Easier way to create python executable standalone program in window

Creating a python executable in pycharm is harder than creating it in visual studio or creating a vb.net executable.
I thought I'd understand how to do this already but it looks like I have not.
I created a question regarding this in Dec of last year, here >> Create a simple python executable program and an icon to it - Hello World.
But I don't understand the answer or if it was answered completely. So I did my research again and found 2 helpful sites below that helped me create python executable without visual studio involved,
https://pythonhosted.org/PyInstaller/installation.html
https://pythonhosted.org/PyInstaller/usage.html#using-pyinstaller.
I followed the instructions exactly:
In command line, set path to C:\Python34\Scripts, then type pyinstaller "C:\Users\Desktop\PROGRAMs\TEST22.py".
This creates a TEST22.spec file in C:\Python34\Scripts and creates a folder TEST22 in C:\Python34\Scripts\dist and in there, are the TEST22.exe. I click on this executable to run the program, it runs completely fine. But when I copied the executable to the desktop, for example, it doesn't run. It seems like in the scripts folder there are files needed to run it and when it's a stand alone program there are no file to run it. Could someone let me know an easier way to create executable and please advise me on how I could fix it when the executable is copied to desktop or anywhere else and run it ?
Your answer lies in pyinstaller documentation. The dist folder itself is a standalone program directory. To get a single file exe with pyinstaller is not possible even thou pyinstaller has -F option for single exe since it dosnt contain data files.
I would suggest use py2exe and inno setup for creating installer

Resources