How do I run a .PY file in Linux?

Hương Trang

New member
How do I run a .PY file in Linux?
Answer
Linux (advanced)[edit]
  1. save your hello.py program in the ~/pythonpractice folder.
  2. Open up the terminal program.
  3. Type cd ~/pythonpractice to change directory to your pythonpractice folder, and hit Enter.
  4. Type chmod a+x hello.py to tell Linux that it is an executable program.
  5. Type ./hello.py to run your program!
Photo in the article by “Flickr”
Code:
https://www.flickr.com/photos/xmodulo/8916138220/
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.
 

Tìm kiếm

Back
Top