📜  在远程服务器上运行 python 脚本 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:27.856000             🧑  作者: Mango

代码示例1
As others have said, pipe it into ssh. But what you will want to do is give the proper arguments. You will want to add -u to get the output back from ssh properly. And want to add - to handle the output and later arguments.

ssh user@host python -u - < script.py
If you want to give command line arguments, add them after the -.

ssh user@host python -u - --opt arg1 arg2 < script.py