Just put this in the first line of your script :

#!/usr/bin/env python

Make the file executable with

chmod +x myfile.py

Execute with

./myfile.py
Answer from Vincent Van Den Berghe on Stack Overflow
🌐
Red Hat
developers.redhat.com › articles › 2021 › 08 › 26 › build-your-first-python-application-linux-container
Build your first Python application in a Linux container | Red Hat Developer
September 19, 2023 - The Python code to run as the HTTP server. The Dockerfile build instructions to build the container image. Note: I'm borrowing the code for this article from my colleague Mike Guerette. See his tutorial Build your first application using Python 3.5 on RHEL 7 with containers and Red Hat Software Collections if you need instructions for building a Python application on RHEL 7.
🌐
Opensource.com
opensource.com › article › 20 › 4 › package-python-applications-linux
How to package Python applications for Linux | Opensource.com
April 16, 2020 - One way to make Python applications installable on Debian-based operating systems (such as Debian or Elementary OS) is by using the dh_virtualenv tool. It builds a .deb package that wraps a Python virtual environment around an application and ...
Discussions

Standalone Python applications in Linux - Stack Overflow
How can I distribute a standalone Python application in Linux? I think I can take for granted the presence of a recent Python interpreter in any modern distribution. The problem is dealing with th... More on stackoverflow.com
🌐 stackoverflow.com
I wrote a linux application in python and pyqt. How do I make and publish it on linux appstore
Haha... welcome to packaging hell :D I'm not an expert, but, in a nutshell: - If you chose to do it from scratch, the "unix way", you'd have to target a specific distro and include a list dependencies in some sort of config file to create a .deb or .rpm file. If you have tons of dependencies, you'd probably have to maintain your own repo as well. - You could do it the "windows way", put your program + its dependencies + python in one folder (with Python, you can use tools like venv to do it automatically) and use a tool like makeself, or a custom script to act as an installer. - The easiest way, though, in your scenario, is to use pyinstaller: https://realpython.com/pyinstaller-python/ More on reddit.com
🌐 r/linuxquestions
75
91
June 2, 2020
How to build python application to linux executable one file? - Stack Overflow
I could still run the file from ... get an applicaiton that can be opened by simply double-click. ... I think with Linux you don't need an executable really, just a shebang at the top of the file, rename it without the .py extension and make it executable i.e. add #!/usr/bin/env python3 at the top, rename to main instead of main.py, then do chmod 755 main ... @RolvApneseth Thanks very much for the ... More on stackoverflow.com
🌐 stackoverflow.com
June 20, 2021
pyinstaller - How to create standalone program(on linux) from my python code? - Stack Overflow
My Code : https://www.paste.org/103827 I have written a small piece of code which works scraps HTML table containing COVID19 data and transforms it into pandas dataframe. Then it saves that datafr... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Quora
quora.com › How-can-I-make-software-that-runs-in-Linux-using-Python
How to make software that runs in Linux using Python - Quora
Answer (1 of 2): What kind of software are you looking to develop for? if you want to make GUI application then starts with PyQt.Its easy to use.You can drag and drop your application without writing a single lines of code. After creating a application you must convert py file into exe.for this...
🌐
Medium
medium.com › analytics-vidhya › how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4
How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidhya | Medium
October 9, 2020 - Step 1 : Make sure python3 development libraries are available (Linux users) ... Big Data Solution Architect | Adjunct Professor. Thoughts and opinions are my own and don’t represent the companies I work for. ... Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building ...
Find elsewhere
🌐
Princeton University
introcs.cs.princeton.edu › python › linux3
Hello World in Python 3 on Linux
Having installed Python, the Python standard libraries, IDLE, Tkinter, NumPy, Pygame, and the booksite libraries, and having configured IDLE, you are ready to compose your first Python program. Perform these instructions: Using your file manager, create a directory named /home/yourusername/hello. Open a Terminal window. Issue the cd hello command to make the /home/yourusername/hello directory your working directory. Issue the command idle3 & to launch IDLE. Note the trailing ampersand. The trailing ampersand tells the computer to run the idle3 program in the background, thereby leaving your Terminal application free to handle additional commands while IDLE is running.
🌐
Python
docs.python.org › 3 › using › unix.html
2. Using Python on Unix platforms — Python 3.15.0 documentation
Python comes preinstalled on most Linux distributions, and is available as a package on all others. However there are certain features you might want to use that are not available on your distro’s package. You can compile the latest version of Python from source. In the event that the latest version of Python doesn’t come preinstalled and isn’t in the repositories as well, you can make packages for your own distro.
🌐
Medium
medium.com › codex › create-standalone-linux-installer-for-your-python-ai-application-5a31d99f9094
Create Standalone Linux Installer for your Python GUI Application | by Rahul Thai Valappil | CodeX | Medium
July 16, 2021 - It allows Python developers to create and distribute a graphical application like the C++ program in Linux. The same can be achievable in Windows but needs to adapt the script based on the windows environment. You may need to use software like Inno Setup instead of makeself to build an installer for ...
🌐
Stack Overflow
stackoverflow.com › questions › 68057056 › how-to-build-python-application-to-linux-executable-one-file
How to build python application to linux executable one file? - Stack Overflow
June 20, 2021 - I could still run the file from ... get an applicaiton that can be opened by simply double-click. ... I think with Linux you don't need an executable really, just a shebang at the top of the file, rename it without the .py extension and make it executable i.e. add #!/usr/bin/env python3 at the top, rename to main instead of main.py, then do chmod 755 main ... @RolvApneseth Thanks very much for the ...
🌐
Medium
medium.com › @trstringer › creating-a-python-package-for-ubuntu-from-code-zero-to-apt-install-d02d0108144c
Creating a Python package for Ubuntu… From code zero to apt install | by Thomas Stringer | Medium
May 24, 2020 - Some of the work I am doing right now has me creating packages that should be distributed to Ubuntu Linux machines. For those of us that…
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › how-to-create-gui-applications-under-linux-desktop-using-pygobject
How to Create GUI Applications Under Linux Desktop Using PyGObject - GeeksforGeeks
July 23, 2025 - Step 3: The following screenshot displays the GUI of Glade application. Step 4: Now, we will be creating the Window on which control objects are been placed. So, select the Window(GtkWindow) from Top Levels option. Step 5: Now, place the button on the Window from Control option. Step 6: Make sure to click the clicked option in signals tab and give the name to the handler as button1_clicked. Step 7: Click on the Save option and save the file as myprogram.glade. Step 8: Now, create a new python file by using a text editor and adding the below line of code into it.
🌐
TechRepublic
techrepublic.com › home › developer
How to create and run a Python app - TechRepublic
November 7, 2022 - The first thing you must do is install the latest version of Python. To do that, open a terminal window on your Linux machine and issue the command: ... If you’re working with either macOS or Windows, download the required installer for your ...