How to run Python on Server

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:

  1. Type “ssh user@host” into the Mac Terminal. For example, if your username is bill and your host is microsoft.com, then type “ssh bill@microsoft.com”.
  2. 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.)
  3. 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!

Unknown's avatar

Author: mathtuition88

Math and Education Blog

One thought on “How to run Python on Server”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.