How to run Python script on terminal?

前端 未结 7 691
醉话见心
醉话见心 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条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 08:55

    First of all, you need to move to the location of the file you are trying to execute, so in a Terminal:

    cd ~/Documents/python
    

    Now, you should be able to execute your file:

    python gameover.py
    

提交回复
热议问题