簡體   English   中英

使用Fabric的run命令在遠程計算機上運行python腳本時出錯

[英]Error when running python script on remote machine using Fabric's run command

我正在嘗試從遠程計算機A使用Fabric的run函數運行在遠程計算機B上托管的python腳本。 但是,出現以下錯誤。

我嘗試將env.shell更改為計算機B的“哪個python”目錄,但是它不起作用。

with cd('/opt/app/transfer_learning'):
    run("python script.py")

預期結果是看到正在執行的腳本,該腳本會將某些內容上傳到MongoDB,我將在其中偵聽更改。 但是,將彈出以下錯誤:

[3.0.40.214] run: python script.py
[3.0.40.214] out: /bin/bash: python: command not found
[3.0.40.214] out:


Fatal error: run() received nonzero return code 127 while executing!

Requested: python script.py
Executed: /bin/bash -l -c "cd /opt/app/transfer_learning >/dev/null && python script.py"

謝謝furas提供的解決方案。 我在run()函數中使用了“ / full / path / to / python script.py”,它可以正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM