Hương Trang
New member
How do I run a .PY file in Linux?
Answer
Linux (advanced)[edit]
To open a terminal quickly from the GUI, the shortcut Ctrl+Alt+T will work on most distributions and desktop environments.
Using sudo will run any command with administrative rights.
Most Linux commands that have to deal with system files and installation/uninstallation of programs demand sudo.
Answer
Linux (advanced)[edit]
- save your hello.py program in the ~/pythonpractice folder.
- Open up the terminal program.
- Type cd ~/pythonpractice to change directory to your pythonpractice folder, and hit Enter.
- Type chmod a+x hello.py to tell Linux that it is an executable program.
- Type ./hello.py to run your program!
Code:
https://www.flickr.com/photos/xmodulo/8916138220/
Using sudo will run any command with administrative rights.
Most Linux commands that have to deal with system files and installation/uninstallation of programs demand sudo.