How do I run a .PY file in Terminal?

How do I run a .PY file in Terminal?
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!
 

Tìm kiếm

Back
Top