I was trying to learn how to run Python scripts on a (remote) server. Amazingly, none of the Google first page results were relevant to what I wanted to do.
After much research (and searching around on the web), the steps that made it work are:
- Type “ssh user@host” into the Mac Terminal. For example, if your username is bill and your host is microsoft.com, then type “ssh firstname.lastname@example.org”.
- The system will prompt you for your password. Enter it carefully. (You may be locked out if too many incorrect passwords are entered. To unlock it, you will need to email your system administrator to unblock your computer’s IP address.)
- Once you are into the server, type “python file.py” to run your Python script named “file.py” (You may need to change directory using the “cd” command if your Python file is in another folder. Type “dir” to see what is in your current directory.) To use Python 3, type “python3 file.py” instead.
That’s all to it!