0

I created a simple python script which can give what kind of operating system it is using. But I want this script to run multiple remote machine at a same time without installing it on other machine on the same network. Is it possible to run this script on remote machine without installing this script on remote machine? . I saw with ssh python can do this .

man7
  • 23
  • 5
  • 1
    *"...I saw with ssh python can do this ..."* - what this does is using an existing Python interpreter on the remote system. So yes, you don't need to install one, but only because it is already installed. – Steffen Ullrich Apr 30 '19 at 19:31
  • 1
    Possible duplicate of [How to make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency) - once you have a binary you can transfer and run it on the remote machine. – Steffen Ullrich Apr 30 '19 at 19:32
  • Fabric is an option: http://www.fabfile.org/ – David Robles Apr 30 '19 at 19:33
  • Even tools like Ansible rely on there being a remote interpreter available. That's a pretty safe expectation -- I haven't seen a server (non-embedded) OS that shipped without *some* kind of Python interpreter in probably a decade now. Writing code that works on both Python 2 and Python 3 is likewise a little tricky, but very much doable. – Charles Duffy Apr 30 '19 at 19:36

1 Answers1

1

Based on the way your question is worded, I think the answer is no.

If you want to run a python script on a remote machine, you will need to have a python interpreter of some kind available on the remote machine to execute the code.

Brandon Tweed
  • 348
  • 1
  • 15
  • 2
    There are, however, ways to create a single file that will contain both the interpreter and the code. OP should check out [PyInstaller](https://www.pyinstaller.org/) – Filip Dimitrovski Apr 30 '19 at 19:39