sh 1 sudo not found python 在 ubuntu 上完成的脚本不适用于 bananian

sh 1 sudo not found python script done on ubuntu does not work on bananian

我在 ubuntu 上制作了一个脚本,现在我希望它在我的香蕉派上使用 bananian 运行(raspbian 用于香蕉派)。 这是我的脚本中出现问题的部分:

foundmob= False
foundusb= False

sudoPassword='figaro'#my sudo password
command="usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000011062000000100000000000000000000'" # the command that for ce the modem to be on serial mode
while foundusb!= True : # this allows me to look for the modem as an usb and then force it

    foundmob=terminalComAndRead("lsusb",'12d1:1f01')#doing a ls usb and then looking for the id of my device
    changemob=terminalComAndRead("lsusb",'12d1:1001')#this is the id of my device when it is already in serial mode

    if foundmob == True :

        os.system('echo %s|sudo -S %s' % (sudoPassword, command))# this is the line who execute the command on sudo

当我在 ubuntu 中执行这个脚本时,我没有任何问题,但是当我想用我的 banana pi 在 bananian 上执行它时,我得到这个错误:

sh: 1: sudo: not found

似乎错误来自这一行:

os.system('echo %s|sudo -S %s' % (sudoPassword, command))# this is the line who execute the command on sudo

因此尝试在 sudo 和另一个登录(不是 sudo)中 运行 它。但它仍然不起作用。有人有想法吗?谢谢

也许 sudo 它不在 PATH 中或未安装。 Have you verified it?

该错误消息是说 python 脚本找不到 sudo 命令。 bananian 安装有 sudo 命令吗?您需要 sudo 才能获得执行 usb_modeswitch 命令所需的权限吗?