The Python interpreter is usually installed as /usr/local/bin/python . Putting /usr/local/bin in your Unix shell's search path makes it possible to start it by typing the command.
python
You may be able to check where the python is installed by typing "which python".
You can put all your commands in a file with the extension 'file_name.py' and run it by
typing:
python file_name.py
Note that there is a difference between "python file" and "python
Python scripts can be made directly executable, like shell scripts, by putting the line (assuming the python path as used in the example above)
#! /usr/local/bin/python
at the beginning of the script and giving the file an executable mode. The "#!" must be the first two characters of the file. On some platforms, this first line must end with a Unix-style line ending ("\n"), not a Mac OS ("\r") or Windows ("\r\n") line ending. Note that the hash, or pound, character, "#", is used to start a comment in Python.
The script can be given a executable mode, or permission, using the chmod command:
$ chmod +x myscript.py