How to run Python script on terminal?
Solution 1:
You need python installed on your system. Then you can run this in the terminal in the correct directory:
python gameover.py
Solution 2:
You can execute your file by using this:
python /Users/luca/Documents/python/gameover.py
You can also run the file by moving to the path of the file you want to run and typing:
python gameover.py
Solution 3:
This Depends on what version of python is installed on you system. See below.
If You have Python 2.* version you have to run this command
python gameover.py
But if you have Python 3.* version you have to run this command
python3 gameover.py
Because for MAC with Python version 3.* you will get command not found error
if you run "python gameover.py"
Solution 4:
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
Solution 5:
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
.