mogo4414
Posts: 52
Joined: Fri Mar 27, 2020 1:10 am

Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 1:37 am

Hello,

I was attempting to open an ".exe" file, on my Pi, that I created on my Windows computer. As you probably already know, it did not work. Anyways, after looking through some of the forum posts, I realized the incompatibility.

I was just curios how might I take source code, while on the pi, and create a file which functions similar to that of a windows ".exe". Basically I'm just looking to create a desktop app (with my own source code) on the pi, that when you click on it, the program runs without additional steps needed. (No cmd line, no thonny etc...)

I saw ".deb" as an option? Sorry, I'm not that well versed in Linux.

Any guiding comments would be greatly appreciated. Thanks in advance for the help!

bjtheone
Posts: 770
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 1:53 am

Horribly simplified, there are two main types of languages (complied and interpreted). Compiled languages result in a standalone binary (like the .exe on windows) that you can then run. The main compiled language on the Pi is C. It is also what most of Linux is written in. Interpreted languages require the interpreter to run. The main interpreted language on the Pi is likely Python. There are many, many more programming languages available. If you are just starting to learn programming, Python is likely a better place to start.

Short and very simplified answer: Yes you can code, compile and execute programs totally on the Pi.

The "run click on it and run" bit requires the appropriate file manager settings but certainly can be done. Note you can do this to launch a shell script, a Python program, or a C program. You also could create and define an icon on the Desktop than to click to launch your program, or could have it start when you boot up the Pi. Lots of different options available depending on what you are trying to achieve.

".deb" is a package standard for applications. Two of the largest packaging standards are .deb (for Debian systems) and .rpm (for Redhat systems).

W. H. Heydt
Posts: 12431
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 2:02 am

Traditionally, and inherited from unix, Linux doesn't really pay any attention to file extensions. By convention, source files have an extension to identify what language it is written in, thus you will see ".py" or ".c" files (for Python and C, respectively). Sometimes, compiler output files (object files) may have a ".o" extension. Executable files don't have any extension at all. So if you have a program "fred.c", the compiler output would be "fred.o" and the executable would be "fred". So you would run it (assuming it is in your path) by typing "fred" plus any commandline options or parameters. (And if the executable isn't in your path, the you would type "<path>/fred", which might be as short as "./fred".)

Welcome to a larger world.

pidd
Posts: 303
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 2:47 am

Edit: Ignore
Last edited by pidd on Mon Jul 06, 2020 4:58 pm, edited 1 time in total.

pidd
Posts: 303
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 2:48 am

pidd wrote:
Mon Jul 06, 2020 2:47 am
if its a python file you can use a shell script

edit a file with name myprog (or whatever you want, preferably match the .py file)

Code: Select all

#!/bin/bash
python myprog.py
then make it executable

Code: Select all

chmod +x myprog
=====================================

Alternatively you can make the .py file into a shell executable

edit the .py file and put this as the first line

Code: Select all

#!/usr/bin/env python
Then make the .py file executable

Code: Select all

chmod +x myprog.py

User avatar
neilgl
Posts: 2111
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 8:54 am

Also have a look at guizero on the pi.

GilGill
Posts: 2
Joined: Mon Jul 06, 2020 12:50 pm

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 1:22 pm

As has been mentioned, there are two main types of code: compiled and interpreted (scripting).
Python is mentioned as an interpreted language.
Another such is Java. Have written Java some 17 or 18 years ago on an old Windows XP machine that still runs on Linux and Windows 10.
The real challenge with any cross-platform code is when developing a graphical user-interface (GUI).

mogo4414
Posts: 52
Joined: Fri Mar 27, 2020 1:10 am

Re: Creating an .exe equivalent on Raspberry Pi

Mon Jul 06, 2020 2:59 pm

Thank you very much for the helpful explanations and solutions!

I'm going to try a few of the options that have been detailed and see what works best for my specific situation.

Thanks again!

Return to “Beginners”