How to run Python script on terminal?

前端 未结 7 640
醉话见心
醉话见心 2020-11-28 08:19

I want to run a Python script in Terminal, but I don\'t know how? I already have a saved file called gameover.py in the directory \"/User/luca/Documents/python\".

相关标签:
7条回答
  • You first must install python. Mac comes with python 2.7 installed to install Python 3 you can follow this tutorial: http://docs.python-guide.org/en/latest/starting/install3/osx/.

    To run the program you can then copy and paste in this code:

    python /Users/luca/Documents/python/gameover.py
    

    Or you can go to the directory of the file with cd followed by the folder. When you are in the folder you can then python YourFile.py.

    0 讨论(0)
提交回复
热议问题